Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: shift and logical or

by 2teez (Priest)
on Nov 16, 2012 at 23:14 UTC ( #1004264=note: print w/ replies, xml ) Need Help??


in reply to shift and logical or

Since you understand the shift and logical or ||, then maybe a simple example will illustrate the usage:

use warnings; use strict; my $age = 15; print get_age($age); # my age is: 15 print "\n"; print get_age(); # my age is: 200 sub get_age { my $my_age = shift || 200; return " my age is: ", $my_age; }

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: shift and logical or
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-07-24 03:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (156 votes), past polls