What does 'qw(..)' mean? What's the use of it?when do we use it?

Showing Answers 1 - 6 of 6 Answers

loginprompt

  • Jun 20th, 2006
 

qw// is a construct which quotes words delimited by spaces. use it when you have a long list of wordes that are not quoted or you just don't want to type those quotes as you type out a list of space delimited words

  Was this answer useful?  Yes

gnana

  • Oct 31st, 2006
 

the quoting opeator for lists is qw.advantage of qw is you need not quote the strings in additional way as qw already does quoting.

  Was this answer useful?  Yes

wow_suraj

  • Jun 8th, 2009
 

qw stands for 'Quote word'. It usually used to create array.
           Ex. @arr = qw/one two three/;
           This will create an array with elements one, two and three.

Instead of '/' symbol, any other symbol can be used.
           Ex. @arr = qw #one two three#;
                 @arr = qw %one two three%;

If using brackets as symbol, we have the option to use open and closing braces on either end.
           Ex.  @arr = qw [one two three];
           or,  @arr = qw{one two three};
           or,  @arr = qw (one two three);

Note: Each space considered as seperator for new element.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.