To clarify - unlike scalars, arrays and hashes can't be "undefined". They can be empty, which is slightly different.
monarch, to test for emptiness, you said:
If the hash is empty then (@keyarr == 1).
I think you mean 0 not 1:
my %hash; my @keyarr = keys %hash; print scalar @keyarr;
prints 0.
In reply to Re^2: Defined vs. undefined
by muntfish
in thread Defined vs. undefined
by tamaguchi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |