Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Re: My coding guidelines

by sauoq (Abbot)
on Dec 01, 2002 at 05:36 UTC ( #216731=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: My coding guidelines
in thread My coding guidelines

This save you from adding extra shifts or assigning extra variables when you add a value to be be passed in. So you don't have to my $x=$_[0]; my $y=shift;.

I don't really understand the point you are trying to make with that statement.

Generally, I prefer my ($x) = @_; and, if a new parameter is later needed, I add it. So that would become my ($x, $y) = @_; when I add the second parameter.¹

By the way, the code example you gave is in error. It would result in $y containing the same value as $x.

¹ Those who saw my other response to Abigail-II in this thread might wonder about my use of whitespace with my ($x) as I indicated that I prefer alternatives to foo ($bar). I treat my, our, and local differently because they are different. They are keywords for declaring scope, they aren't functions.

-sauoq
"My two cents aren't worth a dime.";


Comment on Re: Re: Re: Re: My coding guidelines
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-31 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls