Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: In What basis the subroutine return values assign to variables ?

by bart (Canon)
on Jul 30, 2007 at 10:40 UTC ( [id://629522]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my ($price, $floor) = &get_price_floor() || 0;
  2. or download this
    return (10, 8);
    
  3. or download this
    my ($price, $floor);  ## needs to be declared in a separate statement
    ($price, $floor) = &get_price_floor() or ($price, $floor) = (0, 0);
    
  4. or download this
    sub good { return (10, 8); }
    sub bad { return (); }
    ...
    print "good: price=$price, floor=$floor\n";
    ($price, $floor) = bad() or ($price, $floor) = (0, 0);
    print "bad: price=$price, floor=$floor\n";
    
  5. or download this
    good: price=10, floor=8
    bad: price=0, floor=0
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-26 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found