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=$_; 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.
"My two cents aren't worth a dime.";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||