The qw// operator is discussed in perlop. The semantics are essentially that within a qw quote-like operator, whitespace separates elements. So: qw{ABCGE ABCGE} represents two elements, not one. This is different behavior from q// or qq//, which would return a single element:
my @list = qw{ABCDE DEFGH}; # @list has two elements.
my @list = qq{ABCDE DEFGH}; # @list has one element.
my @list = q{ABCDE DEFGH}; # @list has one element.
Therefore, these two things ARE equivalent:
my @list = qw{ABCDE DEFGH}; # Two elements.
my @list = ('ABCDE', 'DEFGH'); # Two elements.
And these are equivalent:
my @list = ([qw{ABCDE DEFGH}], [qw{IJKLM NOPQR}]); # Two array-refs w
+ith two elements in each.
my @list = (['ABCDE, 'DEFGH'], ['IJKLM', 'NOPQR']); # Two array-refs w
+ith two elements in each.
And the following produces four elements:
my @list = ('ABCDE', qw{DEFGH IJKLM}, 'NOPQR'); # Four elements.
|