If someone else comes along and adds (for instance) a"harmless" subroutine call that sometimes does a pattern match of its own between the match and the usage of $1, then the results are unpredictable because the intervening match has reused the global variables.
If you always capture the value in a separate variable immediately, you're safe from this potential bug.
In reply to Re^4: Extracting text from a line
by pemungkah
in thread Extracting text from a line
by kirkbrown
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |