Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: shift and logical or

by 2teez (Vicar)
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004264]
help
Chatterbox?
[hippo]: See also Getting Started with Perl for some gentle introductory tutorials.
[thao4]: I don't see where I can post my question. I am french so not good in English
[erix]: go to the bottom of this page: Seekers of Perl Wisdom

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2018-02-21 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (276 votes). Check out past polls.

    Notices?