So if you ever run into this warning then just change the quoting character for qw and the error message goes away.use strict; use warnings; my %hash=(a=>1,b=>2,c=>4,d=>8); local $,="\t"; local $\="\n"; print @hash{qw'a b c d'}; # This throws a warning! print @hash{qw(a b c d)}; # This doesnt! __END__ Scalar value @hash{qw'a b c d'} better written as $hash{qw'a b c d'} at D:\temp\hashbug.pl line 8. 1 2 4 8 1 2 4 8
But still if theres a logical reason for this Id love to hear it.
UPDATE:
To make it even weirder it seems that when you use the following notation you dont get warnings
$ref=\%hash; print @{$ref}{qw'a b c'};
Yves / DeMerphq
--
Have you registered your Name Space?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bug with qw in hash slice.
by japhy (Canon) on Nov 22, 2001 at 20:38 UTC | |
by danger (Priest) on Nov 23, 2001 at 20:55 UTC | |
by grinder (Bishop) on Nov 23, 2001 at 02:42 UTC | |
|
Re: Bug with qw in hash slice.
by japhy (Canon) on Nov 22, 2001 at 20:34 UTC |