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

Re: return more than 1 value

by Ratazong (Monsignor)
on Jul 29, 2010 at 06:43 UTC ( [id://851858]=note: print w/replies, xml ) Need Help??


in reply to return more than 1 value

The subroutine ends with the return-statement. Therefore, in your case the line  return @val; will never be executed.

In order to return more than one value, put all your return-values in a list, array or a hash and return that. The caller of your sub will then need to split the individual return-values ...

HTH, Rata

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-07-15 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.