Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Default subroutine parameters

by thelenm (Vicar)
on Apr 22, 2002 at 16:35 UTC ( #161091=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub mysub {
      my $foo = shift || 'default';
      # do stuff
    }
    
  2. or download this
    sub mysub {
      my $foo = shift; $foo = 'default' unless defined $foo;
      # do stuff
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://161091]
Approved by Albannach
Front-paged by giulienk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-07-25 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (170 votes), past polls