I'm not sure what you're asking here. Is the idea that if you find the string you're looking for, print the message and end? If that's the case, then what you want is last :
my $found=0;
while(<>) {
if (/woot!/) {
print "You said woot!\n";
$found=1;
last;
}
}
print "Nobody said 'woot!'\n" unless $found;
Notice also the addition of the variable that's set to a true value if you find the string you're looking for.
HTH (Oh, and BTW, since this is a public site ... you might want to pick less 'ripe' examples =)
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>);
+$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth
+er_name\n"'