Perl——qw()函数

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
相关推荐
wuyk5555 小时前
第2章:六步换相原理全解+STM32工程实战
c语言·开发语言·stm32·单片机·嵌入式硬件
hey_sml5 小时前
JAVA每日一学---CompletableFuture中thenApply与thenCompose区别详解
java·开发语言
萧瑟余晖6 小时前
Java深入解析篇十七之SpringCloud
java·开发语言
ttod_qzstudio7 小时前
Java 常用语法极简通关(五):类与对象——字段、方法、构造器、this 与 static
java·开发语言·python
萧瑟余晖8 小时前
Java深入解析篇十七之Spring Security
java·开发语言·spring
二十雨辰11 小时前
[Java]-Spring面试题
java·开发语言
_oP_i11 小时前
python 后缀 mjs文件
开发语言·python
萧瑟余晖11 小时前
Java深入解析篇二十二之虚拟线程
java·开发语言
油丶酸萝卜别吃12 小时前
Java 集合类全景介绍
java·开发语言
Iruoyaoxh12 小时前
类和对象~
开发语言·c++