From: Robin Houston Date: Thu, 5 Apr 2001 18:03:23 +0000 (+0100) Subject: "${foo}bar", "${foo}[1]" etc. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8fed110457227e00a470209fe85c3213e99600a1;p=p5sagit%2Fp5-mst-13.2.git "${foo}bar", "${foo}[1]" etc. Message-ID: <20010405180323.A16388@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9567 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index fa402cb..53f2006 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") {