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
相关推荐
Momentary_SixthSense12 分钟前
serde
开发语言·rust·json
MediaTea18 分钟前
Python 文件操作:JSON 格式
开发语言·windows·python·json
2501_9307077824 分钟前
使用C#代码添加或删除PPT页面
开发语言·c#·powerpoint
百锦再32 分钟前
金仓数据库提出“三低一平”的迁移理念
开发语言·数据库·后端·python·rust·eclipse·pygame
茉莉玫瑰花茶38 分钟前
从零搭建 C++ 在线五子棋对战项目:从环境到上线,全流程保姆级教程
开发语言·c++
卡卡酷卡BUG39 分钟前
2025年Java面试题及详细解答(MySQL篇)
java·开发语言·mysql
野生工程师40 分钟前
【Python爬虫基础-1】爬虫开发基础
开发语言·爬虫·python
wuwu_q42 分钟前
彻底讲清楚 Kotlin 的 when 表达式
android·开发语言·kotlin
北城以北88881 小时前
SSM--MyBatis框架之动态SQL
java·开发语言·数据库·sql·mybatis
木易 士心1 小时前
Android 开发核心技术深度解析
android·开发语言·python