免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: nhw_cs
打印 上一主题 下一主题

Perl新手的"非新手"问题 [复制链接]

论坛徽章:
3
技术图书徽章
日期:2013-12-14 13:31:0615-16赛季CBA联赛之八一
日期:2016-03-10 18:23:4615-16赛季CBA联赛之青岛
日期:2016-03-19 11:36:04
11 [报告]
发表于 2011-11-11 12:28 |只看该作者
回复 4# nhw_cs


    我只是说了自己的理解,如果没有帮助到你,你可以继续提问!

论坛徽章:
0
12 [报告]
发表于 2011-11-11 12:46 |只看该作者
Q1: print @array和print "@array"的结果

  1.      $"      This is like $, except that it applies to array and
  2.              slice values interpolated into a double-quoted
  3.              string (or similar interpreted string).  Default is
  4.              a space.  (Mnemonic: obvious, I think.)
复制代码
print "@array" 的输出结果与print无关,只与 $" 有关

论坛徽章:
0
13 [报告]
发表于 2011-11-11 12:54 |只看该作者
回复 1# nhw_cs


    Q2: 函数调用时如果有参数, 似乎括号()是可有可无的
这个括号主要是对一些操作列表的函数的优先级有影响
Programming Perl:
In the absence of parentheses, the precedence of list operators such as print, sort, or chmod is either very high or very low depending on whether you look at the left side or the right side of the operator.

论坛徽章:
0
14 [报告]
发表于 2011-11-11 12:56 |只看该作者
print @array和print "@array"的结果是有差别的, 后者自动添加了空格作为元素间的分隔符显示. 这是print自己 ...
iakuf 发表于 2011-11-11 12:22



    print 一直工作在表上下文吧,硬要分的话你这个貌似反了。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP