Did you run the code the OP posted? Since at least 5.6.1, the $1 set by the regexp inside the if is no longer in scope outside the if. The following illustrates this clearly.
'a' =~ /(.)/; { 'b' =~ /(.)/; print("$1\n"); # b } print("$1\n"); # a
This is documented in perlvar.
In reply to Re^2: ?: and saving backreferences
by ikegami
in thread ?: and saving backreferences
by throop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |