in reply to Check if at least one element of array is bigger than X
This would allow you to (if needed) iterate through the whole loop, but display the message only once.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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check if at least one element of array is bigger than X
by eric256 (Parson) on Apr 09, 2010 at 14:56 UTC |