"be consistent" | |
PerlMonks |
Re^2: Array slices: beyond the end/ Assigning an empty list to a Hash sliceby 7stud (Deacon) |
on Mar 22, 2014 at 19:09 UTC ( [id://1079399]=note: print w/replies, xml ) | Need Help?? |
Your question here seems to imply an assumption. This might be: "Why is indexing beyond the end of the list legal for a slice when it's illegal for an array? Yes, I think I was confused by that because I did this:
And the error convinced me that you can't index beyond the end of the array, but as you pointed out and as "Learning Perl" (6th) says on p. 45:
If the subscript indicates an element that would be beyond the end of the array, the corresponding value will be undef. For comparison:
In Section
Seekers of Perl Wisdom
|
|