- Perl Basics
- Perl - Home
- Perl - Introduction
- Perl - Environment
- Perl - Syntax Overview
- Perl - Data Types
- Perl - Variables
- Perl - Scalars
- Perl - Arrays
- Perl - Hashes
- Perl - IF...ELSE
- Perl - Loops
- Perl - Operators
- Perl - Date & Time
- Perl - Subroutines
- Perl - References
- Perl - Formats
- Perl - File I/O
- Perl - Directories
- Perl - Error Handling
- Perl - Special Variables
- Perl - Coding Standard
- Perl - Regular Expressions
- Perl - Sending Email
- Perl Advanced
- Perl - Socket Programming
- Perl - Object Oriented
- Perl - Database Access
- Perl - CGI Programming
- Perl - Packages & Modules
- Perl - Process Management
- Perl - Embedded Documentation
- Perl - Functions References
- Perl Useful Resources
- Perl - Questions and Answers
- Perl - Quick Guide
- Perl - Useful Resources
- Perl - Discussion
Perl qw Function
Description
This function 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 the example below.
Syntax
Following is the simple syntax for this function −
qw EXPR
Return Value
This function return a list consisting of the element of LIST evaluated as if they were single-quoted.
Example
Following is the example code showing its basic usage −
#!/usr/bin/perl -w @array = qw(This is a list of words without interpolation); foreach $key (@array) { print"Key is $key\n"; }
When above code is executed, it produces the following result −
Key is This Key is is Key is a Key is list Key is of Key is words Key is without Key is interpolation
perl_function_references.htm
Advertisements