Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
go ahead... be a heretic
 
PerlMonks  

Re^2: Determining subroutine return type

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.