http://qs321.pair.com?node_id=216731


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.";