Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL qw(EXPR) Function



Syntax

qw EXPR


Definition and Usage

qw() is a quick way to specify a lot of little single-quoted words. For example, qw(foo bar baz) is equivalent to ('foo', 'bar', 'baz'). Some programmers feel that using qw make Perl scripts easier to read. You can actually use any set of delimiters, not just the parentheses.

Simply you can use qw() to prepare an array as shown in theexample below.

Return Value

  • A list consisting of the element of LIST evaluated as if they were single-quoted.

Example

Try out following example:

#!/usr/bin/perl -w

@array = qw(This is a list of words without interpolation);

foreach $key (@array){
   print"Key is $key\n";
}

It will produce following results:

Key is This
Key is is
Key is a
Key is list
Key is of
Key is words
Key is without
Key is interpolation


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names