in reply to Reading a Flat File and Extracting Data

Provided the fields really are in fixed positions, the unpack idea given by BrowserUK looks very apt. If that isn't the case (for example LONGERNAME can be instead of UPDATE) , I'd make a sequence of regexp rules to match on a what-comes-next basis and iterate on it, something like:
my $fieldSpec = [ { name => "name1", pattern => '\d{2}' }, { name => "trtype", pattern => '\D+' }, { name => "timestamp", pattern => '\d{8}' }, # etc. ]; my $results = []; open my $fh, "<$file" or die $!; while( <$fh> ) { my $result = {}; for my $elt ( @$fieldspec ) { my $pat = $elt -> { pattern }; /^($pat)(.*)$/ or die "unexpected format $_ at $."; $result -> { name } = $elt -> { name }; $result -> { value } = $1; $_ = $2; } push @$results, $result; }
...producing results as a reference to an array of hash in this particular example

-M

Free your mind