# If a lexical with the same name is in scope, it may need to be
# fully-qualified.
sub stash_variable {
- my ($self, $prefix, $name) = @_;
+ my ($self, $prefix, $name, $cx) = @_;
return "$prefix$name" if $name =~ /::/;
return "$prefix$name";
}
+ if (defined $cx && $cx == 26) {
+ if ($prefix eq '@' && $name =~ /^[^\w+-]$/) {
+ return "$prefix\{$name}";
+ }
+ }
+
my $v = ($prefix eq '$#' ? '@' : $prefix) . $name;
return $prefix .$self->{'curstash'}.'::'. $name if $self->lex_in_scope($v);
return "$prefix$name";
my($op, $cx) = @_;
my $gv = $self->gv_or_padgv($op);
return $self->maybe_local($op, $cx, $self->stash_variable("\$",
- $self->gv_name($gv)));
+ $self->gv_name($gv), $cx));
}
sub pp_gv {
}
my $kid = $op->first;
if ($kid->name eq "gv") {
- return $self->stash_variable($type, $self->deparse($kid, 0));
+ return $self->stash_variable($type, $self->deparse($kid, 0), $cx);
} elsif (is_scalar $kid) {
my $str = $self->deparse($kid, 0);
if ($str =~ /^\$([^\w\d])\z/) {
} elsif (!ref($replroot) and $replroot > 0) {
$gv = $self->padval($replroot);
}
- $ary = $self->stash_variable('@', $self->gv_name($gv)) if $gv;
+ $ary = $self->stash_variable('@', $self->gv_name($gv), $cx) if $gv;
for (; !null($kid); $kid = $kid->sibling) {
push @exprs, $self->deparse($kid, 6);