Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Get the length of a list.

by farang (Chaplain)
on Jul 27, 2013 at 16:35 UTC ( #1046670=note: print w/replies, xml ) Need Help??


in reply to Get the length of a list.

Another way, though not necessarily better than the original.

print scalar map $_, (1, 2, 3, 4, 3, 2, 1);
But if other processing is going to be done with the list, might as well just make a named array out of it from the start.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046670]
help
Chatterbox?
[Discipulus]: yes sorry forget and forgive me
[Eily]: for what it's worth I didn't go for the brightest solution either
[Eily]: I tried print eval '2+1/3*(2+2/5))' or print $@
[Eily]: and therefore concluded that the eval did succeed because there was no printed error :P
[Eily]: stupid operator precedence :D

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-10-24 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (287 votes). Check out past polls.

    Notices?