in reply to Re^3: Using exists to check element in array
in thread Using exists to check element in array
"It depends if your meaning of exist exists."
;)
Your table shows exactly a consistent behavior to exists when used with hashes. Unset values just don't exist.
$a[0] was never set, hence it doesn't exist.
I wasn't sure what you and sectokia meant with null-pointer, apparently it's the C-value of unset "gap" values¹ in the underlying C-array.
But those exist only on the C level, not logically in Perl.
> but there might be surprise cases (for (@a)? for ((), @a)? f(@a)?)
I don't understand, probably above my expertise.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
¹) with an index smaller than the maximal index of a set value
|
|---|