Perl 智能操作符 比较 数组 和 标量 无法成功 (问题)
时间:2010-10-20
来源:互联网
如题:
请问是什么问题!

请问是什么问题!
作者: panxinming90 发布时间: 2010-10-20
回复 panxinming90
奇怪啊,我按照你的代码测了一下,能显示Yes啊。要不把你的代码贴上来,一起看看
奇怪啊,我按照你的代码测了一下,能显示Yes啊。要不把你的代码贴上来,一起看看
作者: 珞水的大叔 发布时间: 2010-10-20
代码如下:
复制代码
[root@54 scripts]# /usr/local/bin/perl -v
This is perl 5, version 12, subversion 1 (v5.12.1) built for i686-linux
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@54 scripts]#
- #!/usr/local/bin/perl -w
-
- use strict;
- use 5.010;
-
- my $str = "10";
-
- my @strs = qw/ 9 10 11 /;
- say "Yes" if @strs ~~ $str;
This is perl 5, version 12, subversion 1 (v5.12.1) built for i686-linux
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[root@54 scripts]#
作者: panxinming90 发布时间: 2010-10-20
5.12要写
$str ~~ @strs
而不能写
@strs ~~ $str
$str ~~ @strs
而不能写
@strs ~~ $str
作者: 黑色阳光_cu 发布时间: 2010-10-20
回复 黑色阳光_cu
测试 OK, thank you !
测试 OK, thank you !
作者: panxinming90 发布时间: 2010-10-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28