Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Count the number of return values from a subroutine

by ariels (Curate)
on Jul 09, 2001 at 16:07 UTC ( [id://94948]=note: print w/replies, xml ) Need Help??


in reply to Count the number of return values from a subroutine

So do I, but $n = scalar foo does something completely different from $n = () = foo.

Observe, I have nothing up my sleeve!

sub foo { 5, 17 } # sub returning 2 values my $n1 = () = foo; # $n1 == 2 my $n2 = scalar foo; # $n2 == 17

You forgot the general rule about converting a list to a scalar: "there is no general rule for converting a list to a scalar"!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found