go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Could we from now on agree not to talk about (non)existing array elements, Well we have an exists function, why shouldn't we talk about (non)existing array elements? :-) Existence is an an important point to describe the behaviors of slicing, i.e. mostly returning undef for non-existing elements. (And I think what ikegami meant) Let's express it in LRTs (Lanx's Rule of Thumb ;-) 1. Arrayslices (and hashslices) always return values for all requested elements. Not existing elements are represented as 'undef'.
2. Listlices work alike if and only if at least one of the requested elements exists. Otherwise it returns an empty list.
Note: Maybe the x command in the debugger should better say "empty list" instead of "empty array".... Please correct me if I missed something with this "model" of slice behavior.
Cheers Rolf In reply to Re^9: Array/List Strangeness
by LanX
|
|