Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Default subroutine parameters

by samgold (Scribe)
on Apr 23, 2002 at 03:47 UTC ( #161205=note: print w/replies, xml ) Need Help??


in reply to Default subroutine parameters

Could you check the number of arguments using $#argv and use an if statement to define it or not.
if ($#argv == 0){ $foo = 'default'; }else { $foo = shift; }
or something like that. I hope that helps.

Sam

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-08-17 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?