in reply to Finding the second line an item appears on

my $cnt=0; while (my $line = <>) { $cnt++ if $line =~ /formulae/; last if $cnt>1; } if ($cnt>1) { # got what we wanted } else { # word didn't appear twice }
I'm sure it can be done more succinctly, but this should make obvious what is going on.

UPDATE: ops! thanks Albannach. fixed code above.


-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."