while ( ) { if ( /(foo)|(bar)|(baz)/ ) { print "Found $+ line $.\n"; last; } } __DATA__ Stuff The quick brown baz jumps over the lazy bar foo