use 5.010_001;
use strict;
use warnings;
my %hash = qw/ one um two dois /;
{
local $, = "\t";
say @hash{ qw# one two # };
say @hash{ (qw# one two #) };
}
####
Scalar value @hash{ qw# one two # } better written as $hash{ qw# one two # } at mytest.pl line 12.
um dois
um dois
####
Scalar value @hash{ qw# one two # } better written as
$hash{ qw# one two # } at mytest.pl line 13 (#1)
(W syntax) You've used a hash slice (indicated by @) to select
a single element of a hash. Generally it's better to ask for
a scalar value (indicated by $). The difference is that
$foo{&bar} always behaves like a scalar, both when assigning
to it and when evaluating its argument, while @foo{&bar}
behaves like a list when you assign to it, and provides a list
context to its subscript, which can do weird things if you're
expecting only one subscript.
On the other hand, if you were actually hoping to treat the
hash element as a list, you need to look into how references
work, because Perl will not magically convert between scalars
and lists for you. See perlref.