develooper Front page | perl.perl5.porters | Postings from September 2010

[perl #41460] spurious syntax error when taking keys of anonymous hash

From:
Father Chrysostomos via RT
Date:
September 26, 2010 14:31
Subject:
[perl #41460] spurious syntax error when taking keys of anonymous hash
Message ID:
rt-3.6.HEAD-5116-1285536678-1088.41460-14-0@perl.org
On Wed Feb 07 12:56:19 2007, davidnicol@gmail.com wrote:
> On 2/7/07, Ronald J Kimball <rjk-perl-p5p@tamias.net> wrote:
> > By the way, what's happening is that %{{} is parsed as the hash
> named {, so
> > the second } is indeed unmatched.
> >
> > Adding whitespace in the middle also works:
> > perl -we 'print keys %{{ }}'
> >
> > Ronald
> 
> Is that not a bug? 

It is not a bug.

> What exactly are the rules for when bare \S+
> inside curlies
> gets quoted?  I have been under the impression that \w+ was required,
> which
> '{' does not satisfy.
> 

\w+ is not required in an unquoted hash subscript if it is one character
long.

This is necessary for $${@}, etc.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About