in reply to unexpected: inside sub($1,$2) if do // then arguments will be changed

Note that this issue (already explained by others) isn't limited to $1 and frieds. It can happen to other variables as well, including lexical scoped variables:
use 5.010; use strict; use warnings; my($foo, $bar) = (1, 2); sub baz { say shift; $bar = 3; say shift; } baz $foo, $bar; __END__ 1 3
  • Comment on Re: unexpected: inside sub($1,$2) if do // then arguments will be changed
  • Download Code