in reply to Finding the second line an item appears on
I'm sure it can be done more succinctly, but this should make obvious what is going 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 }
|
|---|