in reply to Scope of RegEx vars like $_

$_ is not a "regexp var". As for $`, $&, $', $1, etc, the variables are global, they will never go out of scope. The values however get either a new value (after a new succesful match), or revert to a previous value (on scope exit), whichever comes first:
"foo" =~ /([aeiou])/; say $1; { "xyz" =~ /([aeiou])/; say $1; "bar" =~ /([aeiou])/; say $1; } say $1; __END__ o o a o

Replies are listed 'Best First'.
Re^2: Scope of RegEx vars like $_
by Steve_BZ (Chaplain) on Mar 13, 2010 at 10:17 UTC

    You're right, sorry sloppy construction.