W
Wolf Behrenhoff
Hello all,
why does the following code produce a warning?
perl -wle'opendir $d, "/home";my %h;@h{readdir $d}=();print for keys %h'
Scalar value @h{readdir $d} better written as $h{readdir $d} at -e line 1.
Of course, one must not follow the advice because that would do
something different.
One can of course write
@h{@{[readdir $d]}}=();
to suppress the warning, but that looks a bit complicated.
Tested with v5.8.8 and v5.10.1.
Wolf
why does the following code produce a warning?
perl -wle'opendir $d, "/home";my %h;@h{readdir $d}=();print for keys %h'
Scalar value @h{readdir $d} better written as $h{readdir $d} at -e line 1.
Of course, one must not follow the advice because that would do
something different.
One can of course write
@h{@{[readdir $d]}}=();
to suppress the warning, but that looks a bit complicated.
Tested with v5.8.8 and v5.10.1.
Wolf