while (<$fh>) { next unless /^internal name/..0 and /^need this/; print "Got one in line ${.}\n"; }