note
sauoq
<blockquote><em>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 <code>my $x=$_[0]; my $y=shift;</code>.</em></blockquote>
<p>I don't really understand the point you are trying to make with that statement.</p>
<p>Generally, I prefer <code>my ($x) = @_;</code> and, if a new parameter is later needed, I add it. So that would become <code>my ($x, $y) = @_;</code> when I add the second parameter.¹</p>
<p>By the way, the code example you gave is in error. It would result in <code>$y</code> containing the same value as <code>$x</code>.</p>
<p><font size=-1>¹ Those who saw my other response to [Abigail-II] in this thread might wonder about my use of whitespace with <code>my ($x)</code> as I indicated that I prefer alternatives to <code>foo ($bar)</code>. I treat <code>my</code>, <code>our</code>, and <code>local</code> differently because they are different. They are keywords for declaring scope, they aren't functions.</p>
<pre>
-sauoq
"My two cents aren't worth a dime.";
</pre>
215675
215808