zoukankan      html  css  js  c++  java
  • qw

    定义和用法

    qw()是用来指定了很多小单引号的句字是一个快速的方法。例如,qw(foo bar baz) 相当于 ('foo', 'bar', 'baz')。一些程序员认为,使用qw使Perl脚本更容易阅读。实际上,你可以使用任何分隔符,而不仅仅是括号组。

    简单地,可以使用qw()准备一个数组,如以下所示的例示的。

    返回值

    • 列表元素的列表组成的计算,如果他们是单引号。

    例子

    试试下面的例子:

    #!/usr/bin/perl -w
    #by www.yiibai.com
    
    @array = qw(This is a list of words without interpolation);
    
    foreach $key (@array){
       print"Key is $key
    ";
    }
    

    这将产生以下结果:

    Key is This
    Key is is
    Key is a
    Key is list
    Key is of
    Key is words
    Key is without
    Key is interpolation
  • 相关阅读:
    Django安装与创建项目
    siege 高并发测试工具
    http_load 高并发测试
    webbench高并发测试
    scss切页面
    切页面
    小程序scss页面布局
    rtrim
    modal结合art-template
    Python 正则表达式
  • 原文地址:https://www.cnblogs.com/yuanjingnan/p/12418479.html
Copyright © 2011-2022 走看看