What is the scope of $1 through $9 in Perl?  For instance, in this code:
sub bla {
    my $x = shift;
    $x =~ s/(\d*)/$1 $1/;
    return $x;    
}
my $y;
# some code that manipulates $y
$y =~ /(\w*)\s+(\w*)/;
my $z = &bla($2);
my $w = $1;
print "$1 $2\n";
What will $1 be?  Will it be the first \w* from $x or the first \d* from the second \w* in $x?