qw()是用来指定了很多小单引号的句字是一个快速的方法。
例如,qw(foo bar baz) 相当于 ('foo', 'bar', 'baz')。
实际上,你可以使用任何分隔符,而不仅仅是括号组。
实例分析
perl
#!/usr/bin/perl -w
@array = qw(This is a list of words without interpolation);
foreach $key (@array){
print"Key is $key\n";
}
输出结果如下:
perl
Key is This
Key is is
Key is a
Key is list
Key is of
Key is words
Key is without
Key is interpolation