加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

学习perl的reverse,sort,scalar

发布时间:2020-12-16 00:19:58 所属栏目:大数据 来源:网络整理
导读:?学习perl的reverse,sort,scalar,记录一下。 [ root @OTRS perl ] # more reverse_sort_scalar.pl #!/usr/bin/perl -w use strict ; #reverse my @array_reverse = 1 . .3 ; my @array_ed = reverse ( @array_reverse ) ; print " 数组的值为1 2 3,reverse反

?学习perl的reverse,sort,scalar,记录一下。

  1. [root@OTRS perl]# more reverse_sort_scalar.pl
  2. #!/usr/bin/perl -w
  3. use strict;
  4. #reverse
  5. my @array_reverse = 1..3;
  6. my @array_ed = reverse(@array_reverse);
  7. print "数组的值为1 2 3,reverse反转数组的值为: ","@array_edn";
  8. #sort
  9. my @array_sort = qw/c b a/;
  10. my @sorted = sort@array_sort;
  11. print "数组的值为c b a,sort排序后为: "@sortedn#scalar强制指定标量上下文。
  12. my @array_scalar = qw/a b c/;
  13. print "数组的值为abc,scalar指出数组的个数为:scalar@array_scalar,0); ">"n";
  14. [root@OTRS perl]# perl reverse_sort_scalar.pl
  15. 数组的值为1 2 3,reverse反转数组的值为: 3 2 1
  16. 数组的值为c b a,sort排序后为: a b c
  17. 数组的值为abc,scalar指出数组的个数为:3

转载自:http://baiqiuyi.com/linux/perl_reverse_sort_scalar.html?replytocom=1985小桥流水人家

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读