Reputation: 1600
What does qw
stand for? Is there any documentation where I can read about it?
Also, how is it related to array declaration? For example:
#!/usr/bin/perl
@days = qw/Mon Tue Wed Thu Fri Sat Sun/;
Upvotes: 6
Views: 4762
Reputation: 385655
I always wonder what is qw stands for!
It stands for "quote words" (or something similar), as it is a quoting construct like single quotes (q/.../
aka '...'
) and double quotes (qq/.../
aka "..."
), but it returns a list of words.
any related document to read on qw ?
The qw
operator is documeted in perlop.
qw/Mon Tue Wed Thu Fri Sat Sun/
is equivalent to
split ' ', q/Mon Tue Wed Thu Fri Sat Sun/
how is it related array declaration?
It has no relation to array declaration. Arrays are both declared and defined using my @array
(and rarely our @array
).
Upvotes: 10