in reply to Like in hashes, do we have something like exists in arrays as well.
Gives:use strict; use warnings; my @stuff = (0,1, undef); for (0..3) { print "Element $_ : " . (!exists ($stuff[$_]) ? 'Does not exist' : !defined ($stuff[$_]) ? 'is Undef' : "is '$stuff[$_]'") . "\n"; }
>perl test.pl Element 0 : is '0' Element 1 : is '1' Element 2 : is Undef Element 3 : Does not exist
|
|---|