None is better, because they do different things! qw// is basically a compile-time construct that (as Deparse shows) returns a LIST. \ LIST is a special form of reference-list constrctor and returns a LIST where each element is a reference to the element of the original list:
my @x = \qw(a b c);
print "$_ $$_ \n" for @x;
[] creates an anonymous ARRAY-ref, which turns out to be a scalar value in the end:
my @x = [qw(a b c)]; #@x has one element
print "$_ @$_\n" for @x;
So when you evaluate \LIST in scalar context, you get what you alway get when forcing a list to scalar context: the last element:
my $x = \qw(a b c);
print "$x $$x\n";
HTH
--
http://fruiture.de |