my $mess = 1; foreach $i(@array) { if($i > 10) { print "Bigger than 10" if $mess; $mess = 0; } } $mess = 1; # In case we want to use it again.