in reply to Re: How do I test if an array is empty or not?
in thread How do I test if an array is empty or not?
Your second code fragment is correct, but it can be written in a more Perlesque way:
my @empties = grep {!defined $array [$i]} 0 .. $#array;
As for the question, just use the array in scalar context. It's empty if the array is 0 in scalar context.
Abigail
|
|---|