$1 and $2 are package variables, not lexicals. You can nest their contents with local. Lexical $_ is a new addition from 5.10.0 onwards.
Best practice is simply to copy out $1 and ilk to lexicals, the way you're doing it (but within a conditional, checking that the match succeeded).
• another intruder with the mooring in the heart of the Perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |