in reply to Re^2: Large file data extraction
in thread Large file data extraction

$allDocs won't contain all records, only the first. <> in scalar context will return one 'record'. Use something like:

local $/ = "<hr>\r"; my $rxExtractDoc = qr {(?xms) (<h4>Award\s\#(\d+)(.*?)<hr>) }; while(<>) { # read one record at a time if($allDocs =~ m{$rxExtractDoc}g ) { my %award = (); # award hash $award{'record'}= $1; $award{'A_awardno'}= $2; $award{'entireaward'}= $3; # $award{'entireaward'}=~ s/\n//g; $award{'entireaward'}=~ s/\t//g; $award{'entireaward'}=~ s/\r//g; # ... rest of code } }

And yes, <> will read from STDIN or filenames from command line.

I hope this helps.

Peter Stuifzand