Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL qw(EXPR) Function
Syntax
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
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
| |
|

|
|
|