Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Referencing Array Slices as Lists?

by takshaka (Friar)
on Sep 05, 2000 at 12:10 UTC ( [id://31098]=note: print w/replies, xml ) Need Help??


in reply to Referencing Array Slices as Lists?

You're thinking that an array slice is itself an array, but it is actually a list. And when you take a reference to a list you get a list of references.

Notice that a slice in scalar context acts like a list (returning the last element), not like an array (returning the number of elements):

# perl -le '@a=(1..9); print scalar @a[2,6,5]' 6

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found