Think about Loose Coupling | |
PerlMonks |
Re^3: Array/List Strangeness (why)by LanX (Saint) |
on Aug 05, 2009 at 17:46 UTC ( [id://786183]=note: print w/replies, xml ) | Need Help?? |
Talking about bull ;-)
BTW, if you want to avoid this particular bit of magic, you can rewrite your list slice as an array slice: [get_a_list()]->[7,0]. And, as quietly noted in the documentation, if you want this behavior for an array slice, just write it as a list slice: (@array)[7,0]. I am pretty sure that slicing while dereferencing with right-arrow isn't (yet) implemented in perl!
Seems that instead to try slicing, the comma is interpreted in scalar context. Hence the last element of the slice-list is chosen as index! UPDATE: the only way I know to slice lists like arrays is:
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|