Um, in both examples you are not setting $_---you are only modifying it.Interesting distinction. I think of them as synonyms, and would certainly argue that any statement that starts with "$_ =" is "setting" the variable. However, what name we use when giving a variable a new value is not really the point.
What makes both of these examples useful is that they implicitly alias $_ to another variable before acting on it. That's where they differ from the OP's usage.
In reply to Re^4: "$_" vs. $_
by mrpeabody
in thread "$_" vs. $_
by argv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |