问个关于匿名数组的问题
时间:2011-06-30
来源:互联网
@array=( [1,2,3],[4,5,6],[7,8,9]); 其每个元素为一个匿名数组的引用,这个没错,但是我想问问,如果使用@arry=qw( [1,2,3] [4,5,6] [7,8,9] );这样的话为什么会在遍历的时候提示说有存在软引用?
作者: lynncate 发布时间: 2011-06-30
本帖最后由 climby 于 2011-06-30 11:18 编辑
qw 的操作是将每个单词作为一个数组元素,在
复制代码
中, [1,2,3] 是按一个类似字面的字符串, 还是按一个匿名的数组引用呢? 有歧义。
我想这就是提示你有软引用的原因吧。
写代码的时候,尽量摒弃这种歧义,理解起来费劲,不如直接
复制代码
简洁明了。
qw 的操作是将每个单词作为一个数组元素,在
- @array=qw([1,2,3] [4,5,6] [7,8,9])
我想这就是提示你有软引用的原因吧。
写代码的时候,尽量摒弃这种歧义,理解起来费劲,不如直接
- @array= ([1,2,3], [4,5,6],[7,8,9]);
作者: climby 发布时间: 2011-06-30
QUOTE:
qw/STRING/
Evaluates to a list of the words extracted out of STRING, using embedded whitespace as the word delimiters. It can be understood as being roughly equivalent to:
split(' ', q/STRING/);
the differences being that it generates a real list at compile time, and in scalar context it returns the last element in the list.
Evaluates to a list of the words extracted out of STRING, using embedded whitespace as the word delimiters. It can be understood as being roughly equivalent to:
split(' ', q/STRING/);
the differences being that it generates a real list at compile time, and in scalar context it returns the last element in the list.
作者: zhlong8 发布时间: 2011-06-30
谢谢,已经明白了
作者: lynncate 发布时间: 2011-06-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28