免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1877 | 回复: 5
打印 上一主题 下一主题

undef $/; 有什么用? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-25 16:05 |只看该作者 |倒序浏览
  Based on the code sample above, what is the effect during input or output?  
Choice 1   
It reads the entire file.  
Choice 2   
It specifies to Perl not to buffer file output.  
Choice 3   
It displays a line at a time in output.  
Choice 4   
It reads a line at a time.  
Choice 5   
It makes later processing case insensitive.  

论坛徽章:
0
2 [报告]
发表于 2012-04-25 19:46 |只看该作者
没有代码怎么看

论坛徽章:
0
3 [报告]
发表于 2012-04-25 20:06 |只看该作者
undef $/的意思是取消默认换行为分隔符
这样可以读入整个文件

论坛徽章:
0
4 [报告]
发表于 2012-04-26 10:13 |只看该作者
$/代表当前输入记录分隔符,默认是新行,把它换成undef,可以一次读入整个文件,不用按行读入

论坛徽章:
0
5 [报告]
发表于 2012-04-26 23:00 |只看该作者
强烈不推荐这样写啊,牵一发而动全身,最好是local $/的方式

论坛徽章:
0
6 [报告]
发表于 2012-04-27 11:49 |只看该作者
推荐使用File::Slurp模块
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP