Perl functions references-qw Function - Perl Scripting

What is Perl qw function?

Description

This function is used to indicate a lot of little single-quoted words in parenthesis. 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 −

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 −
When above code is executed, it produces the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Perl Scripting Topics