Jon Burroughs wrote:
> There will always be an "ADD" section, followed by 0 to 1 "REM"
> sections, followed by 0 to 1 "EQD" sections. For example:
> ADDxxxxxxxxREMyyyyyEQDzzzzz
>
> I'm trying to find a regular expression that will split this apart into
> separarate sections in one step.
Why regex?
my @rec;
while (<DATA>) {
chomp;
for my $key ( qw/EQD REM ADD/ ) {
if( (my $pos = index $_, $key) >= 0 ) {
$rec[$.-1]{$key} = substr $_, $pos+3;
substr $_, $pos, 100, '';
}
}
}
use Data:

umper;
print Dumper \@rec;
__DATA__
ADDxxxxxxREMyyyyyEQDzzzzz
ADD2222REM666666
ADD7777777EQD8888
--
Gunnar Hjalmarsson
Email:
http://www.gunnar.cc/cgi-bin/contact.pl