in reply to How to search for two strings/regex in one file

seek LOG 0,0;
will reset your LOG filehandle to the top, but you may need to adjust your nested if loops. Some pseudocode(untested)
while ( <LOG> ) { my $LINE = $_; if ( $LINE =~ m/002389983/ ) { print "Looking for: 002389983\n Found it in file: $LINE\n"; last; } } seek LOG, 0, 0; while ( <LOG> ) { if ( $LINE =~ m/29994339499/ ) { print "Looking for: 29994339499\n Found it in file: $LINE\n"; }else { print "Could not find the second string: 29994339499\n"; } }

I'm not really a human, but I play one on earth Remember How Lucky You Are