What do you mean with
array is empty??
the @array-variable is not existing(exists)... does only work for single elements ... thanks for the hint moritz!
- the @array-variable is not defined
- the array has zero elements (if (scalar(@array) == 0) ...)
- each element is undefined my $empty = 1; foreach (@array) { $empty = 0 if (defined ($_)); } if ($empty) ...)
- each element is non-existent (similar as above)
- each element is 0 (similar as above)
- each element has a "not-defined"_value (similar as above)
Please select the appropriate solution for your requirements!
Rata
update: See also here: How do I test if an array is empty or not?