in reply to Re: Re: grab only if pattern matches previous line
in thread grab only if pattern matches previous line

If your data file is really large then you should work on the data as you slurp it. I used an array because that is what your sample code used :)

while(<FILE>){ next if /^matches messy header/; chomp; if (/matches some string/){ my $next_line = <FILE>; # do something to $next_line here print "$_, $next_line\n"; } }

--
Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho