No, your first method is the best and most readable way. == imposes scalar context so this is safe as well.
If you are looking for other ways, if (not (@foo-1)) or if (not $#foo) achieve the same, but are not readable anymore.
In reply to Re: Test Number of Elements In Array
by jethro
in thread Test Number of Elements In Array
by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |