$1 is a global variable which should only be carefully used in local context.
But your match within the sub changes this global variable and your alias in $_[0] reflects this.
And after leaving the sub the implicit localization restores the old value of $1...
Better stop messing with perl internals or just pass a copy of $1 or follow chorobas suggestion.
Cheers Rolf
In reply to Re: Side effect of passing matched values by reference
by LanX
in thread Side effect of passing matched values by reference
by puterboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |