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

Re: return more than 1 value

by roboticus (Chancellor)
on Jul 29, 2010 at 06:43 UTC ( #851857=note: print w/replies, xml ) Need Help??


in reply to return more than 1 value

changma_ha:

Like so:

Roboticus@Roboticus-PC ~ $ cat ret.pl #!/usr/bin/perl my ($x, $y) = foo(); print "x=$x, y=$y\n"; sub foo { return 3, 5 } Roboticus@Roboticus-PC ~ $ perl ret.pl x=3, y=5

You simply return a list of values. You can't use two successive return statements, because after the first one, the second will never execute.

...roboticus

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-09-30 00:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (125 votes). Check out past polls.

    Notices?