perl qw - what is?
Perl Qw:
perl qw is quoted words, it is useful for declaring arrays, instead of writing quotes for each strings, we can use qw to minimize it.
Qw Delimiter:
1.space(Recommended and default)
2.comma
3.comment
But using space will be easier to process a array and that is recommended and default.
as per perldoc, below methods are equal.
1. qw(STRING) <=> split(" ", q/STRINGS/);
2. qw(STRING) <=> "STRING1","STRING2";
Method 1:
@array = qw/perl scripting is popular/;
Method 2: using []
@array = qw[perl scripting is popular];
Method 3: using ()
@array = qw(perl scripting is popular);
Method 4:
using space delimiter with comma or comment
Labels: perl qw
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home