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

Re: Trouble getting size of list returned from sub

by kcott (Chancellor)
on Nov 26, 2012 at 09:07 UTC ( #1005597=note: print w/replies, xml ) Need Help??


in reply to Trouble getting size of list returned from sub

G'day wanna_code_perl,

You can achieve this by wrapping bad() in @{[...]}.

$ perl -Mstrict -Mwarnings -E ' sub bad { qw/foo bar baz/ } say scalar bad(); say scalar @{[bad()]}; ' baz 3

-- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005597]
help
Chatterbox?
[marto]: William Gibson was right
[moritz]: a classical problem with machine learning
[1nickt]: moritz isn;t the difference today that the machine learning algos are in charge of most stuffs?
[moritz]: depends on what you mean by "most stuff"
[1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force!
[holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either
[holli]: at least for cars, if the ai works better than a human on average, by all means let the machines drive

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-11-21 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (301 votes). Check out past polls.

    Notices?