because $1, $2, $3 ... are dynamically scoped to the current BLOCK.
see perlvar
$_ = "aaaabbbbcccc"; if ( not /^(\w\w)(\w\w)(\w\w)$/ ) { # inside a block if ( not /^(\w\w)\w\w(\w\w)\w\w(\w\w)\w\w$/ ) { die "failed"; } print "inside: $_ = $1 $2 $3\n"; } #outside a block print "outside: $_ = $1 $2 $3\n";
In reply to Re: capture vars undef
by ccn
in thread capture vars undef
by msemtd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |