thanos1983
Nice solution, but I feel it would be beautiful if one's function has only one return, instead of two or more.
Using a flag as choroba stated.
something like thus:
... sub check { my $seen = 0; for my $el (@{shift(@_)}) { if ($el eq '3'){ # we only need the first occurrence $seen = 1; last; } } return $seen == 1? 'Found': 'Not Found'; # NOTE } ...
In reply to Re^2: Set condition only if array becomes empty
by 2teez
in thread Set condition only if array becomes empty
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |