If you change the if to unless in your second bit of code, you'd get what you want. As the others indicated, you need to change your conditional in some way to take the same code path. Using unless inverts the condition, allowing you to use the same conditional. If you want to use if, rewriting the condition to ! ($#{ $some{$hash} } >= 1 would do it, as would $#{ $some{$hash} } < 1.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: if statement used in foreach-loop?
by roboticus
in thread if statement used in foreach-loop?
by abdel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |