Skip Menu |
Report information
Id: 130958
Status: new
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: rjbs <rjbs [at] cpan.org>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



Subject: inconsistent block/hash detection (again)
From: Ricardo Signes <rjbs [...] cpan.org>
To: perlbug [...] perl.org
Date: Wed, 8 Mar 2017 14:12:32 -0500
Download (untitled) / with headers
text/plain 756b
I realize that the block/hash issue has had a lot of ink spilled over it, but this particular example surprised and baffled me (and Matthew Horsfall, who pointed it out to me today): ~$ perl -MData::Dumper -E 'say Dumper([ map {; { 1 => $_ } } qw(cat) ])' $VAR1 = [ { '1' => 'cat' } ]; ~$ perl -MData::Dumper -E 'say Dumper([ map {; { $_ => 1 } } qw(cat) ])' $VAR1 = [ 'cat', 1 ]; The inside {...} in these two are interpreted differently based on whether the first token is $_ or 1? On one hand, I wish these were consistent. On the other, I realize that this change might break some code somewhere. (Yes, I know you can force the issue with a unary plus.) -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org