Subject: | ${$hashref}{"KEY"} etc braced deref subscript |
Date: | Tue, 16 Dec 2008 10:30:26 +1100 |
To: | bug-PPI [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
In PPI 1.204_01 and recent debian perl 5.10.0, a braced dereferencing
from the "perlref" docs
${$hashref}{"KEY"}
parses as
PPI::Document
PPI::Statement
PPI::Token::Cast '$'
PPI::Structure::Block { ... }
PPI::Statement
PPI::Token::Symbol '$hashref'
PPI::Structure::Block { ... }
PPI::Statement
PPI::Token::Quote::Double '"KEY"'
where I hoped the key part would be PPI::Structure::Subscript, the same
as $foo{"KEY"} or $foo->{"KEY"} get.
The array example ${$arrayref}[0] from perlref parses similarly with
PPI::Structure::Constructor for the [] instead of Subscript.
I struck this in some of my own code taking a hash slice from a hashref
with @{$foo}{0,1,2,3}. Perlcritic complained I'd used a comma operator
in the second part (where of course they're subscripts ...).