http://www.perlmonks.org?node_id=984208


in reply to trouble regexing the next line

If you use Tie::File;, you can tie the file to an array, and then iterate over the array's elements (i.e., the file's lines) using something like for(my $i = 0; $i < scalar @array; $i++){ ... }, looking for a pattern match in each $array[$i], where $array[$i+1] would be the next line in the file (provided $i+1 < scalar @array).