diff options
author | Robin Houston <robin@cpan.org> | 2001-04-05 19:03:23 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-04-05 18:31:45 +0000 |
commit | 8fed110457227e00a470209fe85c3213e99600a1 (patch) | |
tree | 51bea7bfd36c4306c4bc0407b14d772d857e4b2e /ext | |
parent | d9963e6028b7b9385123dbc7e23e5d32a1470cdd (diff) | |
download | perl-8fed110457227e00a470209fe85c3213e99600a1.tar.gz |
"${foo}bar", "${foo}[1]" etc.
Message-ID: <20010405180323.A16388@puffinry.freeserve.co.uk>
p4raw-id: //depot/perl@9567
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B/Deparse.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index fa402cbc8d..53f2006bf9 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -2417,7 +2417,13 @@ sub dq { if ($type eq "const") { return uninterp(escape_str(unback($self->const_sv($op)->PV))); } elsif ($type eq "concat") { - return $self->dq($op->first) . $self->dq($op->last); + my $first = $self->dq($op->first); + my $last = $self->dq($op->last); + # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" + if ($last =~ /^[{\[\w]/) { + $first =~ s/([%\$@])([A-Za-z_]\w*)$/${1}{$2}/; + } + return $first . $last; } elsif ($type eq "uc") { return '\U' . $self->dq($op->first->sibling) . '\E'; } elsif ($type eq "lc") { |