The key for checking whether one of the multi-line records is a keeper or not is at position 19 for a length of ten on the first line
This doesn't really tell us anything that the substr() hadn't already told us. The thing is, we can't reliably count whitespace in the data you provided.
But anyway, since what you want is always on that first line, it's probably a lot easier (and more efficient than using a regular expression) to just read the data line by line ignoring lines that don't match /^##/ and doing what you want with the ones that do. This would have the added benefit of not keeping 300+MB in RAM.
while (<>) {
next unless /^##/;
my $key = substr $_, 19, 10;
do_stuff_with($key);
}
-sauoq
"My two cents aren't worth a dime.";
|