Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Determining subroutine return type

by sandfly (Beadle)
on Feb 24, 2005 at 23:16 UTC ( #434298=note: print w/replies, xml ) Need Help??


in reply to Re: Determining subroutine return type
in thread Determining subroutine return type

Subs returning arrays behave differently to subs returning lists. If your sub returns an array, calling it in scalar context gets you the number of elements. In list context there's no difference.
perl -le "@a=(2,4,6); sub x{@a} print scalar(x());"
prints 3, not 6.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-01-25 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (68 votes). Check out past polls.

    Notices?