![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: hash sliceby Tanktalus (Canon) |
on Mar 10, 2005 at 16:52 UTC ( #438331=note: print w/replies, xml ) | Need Help?? |
I thought that seeing it on my screen would make it easier to understand. I'm missing something here. I was kind of expecting the array to be unchanged ... but that's not what happened:
Obviously, if undef worked as is otherwise expected, all numbers from 2 through 7 would be undef. What surprised me here is that 7 still is undef'd. Something funky is happening. Not that I'd ever have this problem in production code - I don't ever have the need for this type of behaviour (undefing a slice)... and would have thought about using @x[2..7] = () first anyway. Update: Yeah, Roy Johnson explained it - I see that now. However, it's still a bit buried, and Roy Johnson's lengthier explanation below is much clearer. Thanks, Roy!
In Section
Seekers of Perl Wisdom
|
|