Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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

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 scrutinizing the Monastery: (9)
As of 2016-10-26 05:10 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (334 votes). Check out past polls.