Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 162010

Playing with qw() function in Perl


The qw (quote word) function is very useful to generate a list of words.


my @names = ('peter', 'john', 'mark');

print @names;

my @names2 = qw(peter john mark);

print @names2;

As you can see above, the use of qw() made the code more readable.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>