Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Trouble getting size of list returned from sub

by kcott (Canon)
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?
Corion idly wonders if there is a way to produce ordered .yml files. I want to accept YAML for a configuration file format, but I also want to generate (for debugging/start) a sample configuration file from the current configuration.
[Corion]: Ideally, that configuration file would have some order of the keys, but I'm not sure whether/how YAML supports ordered output.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-01-16 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (149 votes). Check out past polls.