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

[perl #74782] bogus warning (that gives bad advice) with qw hash slice keys

Thread Next
From:
David Nicol
Date:
April 30, 2010 01:45
Subject:
[perl #74782] bogus warning (that gives bad advice) with qw hash slice keys
Message ID:
rt-3.6.HEAD-27388-1272572413-1808.74782-75-0@perl.org
# New Ticket Created by  David Nicol 
# Please include the string:  [perl #74782]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=74782 >


Bogus warning with strawberry 5.8.9, when making a list using
qw'...'or qw"..." (but not any other characters) Also in a freshly
compiled
5.8.9. And in cygwin's 5.10.1.

Whatever identifies scalar values and generates the warning is simply
mistaken here, possibly not prepared for qw changing the meaning of
$quot; and &apos;.

C:\thing>perl -wce "eval {@X{qw(abc def ghi)} = @{[1..99]}[37,22,1]}"
Name "main::X" used only once: possible typo at -e line 1.
-e syntax OK

C:\thing>perl -wce "eval {@X{qw'abc def ghi'} = @{[1..99]}[37,22,1]}"
Scalar value @X{qw'abc def ghi'} better written as $X{qw'abc def ghi'}
at -e line 1.
Name "main::X" used only once: possible typo at -e line 1.
-e syntax OK

C:\thing>perl -wle "eval {@X{qw'abc def ghi'} = @{[1..99]}[37,22,1]};
print join 'X', keys %X"
Scalar value @X{qw'abc def ghi'} better written as $X{qw'abc def ghi'}
at -e line 1.
defXabcXghi


Thread Next


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