2003-12-14 正規表現を使ったときの $n のスコープ Perl $1, $2, ... のスコープは現在のブロック内に限定されるようだ。 if (1) { "foobar" =~ /(foo)/; # $1 eq 'foo' } # $1 is undef