相关疑难解决方法(0)

perl 的 -0 选项究竟是如何工作的?

根据man perlrun

-0[octal/hexadecimal]
     specifies the input record separator ($/) as an octal or
     hexadecimal number. If there are no digits, the null character is
     the separator. 
Run Code Online (Sandbox Code Playgroud)

The special value 00 will cause Perl to slurp files in paragraph
mode.  Any value 0400 or above will cause Perl to slurp files
whole, but by convention the value 0777 is the one normally used
for this purpose.
Run Code Online (Sandbox Code Playgroud)

但是,鉴于此输入文件:

This is paragraph one

This is paragraph two.
Run Code Online (Sandbox Code Playgroud)

我得到了一些意想不到的结果:

$ perl …
Run Code Online (Sandbox Code Playgroud)

perl

9
推荐指数
1
解决办法
1522
查看次数

标签 统计

perl ×1