my $found=0; while(<>) { if (/woot!/) { print "You said woot!\n"; $found=1; last; } } print "Nobody said 'woot!'\n" unless $found;