Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2015-10-09 17:27 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (247 votes), past polls