in reply to How to match previous line
One, slurp the file and parse it using subscripts. So when $line[$i] matches, u can pull $line[$i - 1] to get the other value.
Two, save the current line value into a variable which will be available on the next iteration of the loop.
while ($line = <FILE>) { if ($line is good) { dosomething($line, $lastline); } $lastline = $line; }
Three, use Tie::File.
|
|---|