while () { if (/trigger/ .. /timestamp/) { if ( $_ =~ /timestamp/ ) { print "Found timestamp\n"; last; } } }