Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Array slices: beyond the end/ Assigning an empty list to a Hash slice

by 7stud (Deacon)
on Mar 22, 2014 at 19:23 UTC ( [id://1079401]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Array slices: beyond the end/ Assigning an empty list to a Hash slice
in thread Array slices: beyond the end/ Assigning an empty list to a Hash slice

It is the simplest way to distinguish between a slice from an empty list and a slice of a list of undefs. The former is FALSE, the latter is TRUE in a test.

Okay.

The slice returns you exactly the number of elements you asked it to return, not some unexpected or unpredictable smaller number.

False. You do get a smaller number of elements, i.e. 0, when all the slice indexes are beyond the end...as you pointed out:

...UNLESS the whole slice would have to be padded with undefs, in which case you get an empty list

So I think your first point is the only valid reason.

  • Comment on Re^4: Array slices: beyond the end/ Assigning an empty list to a Hash slice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1079401]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-19 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found