微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Perl标志-pe,-pi,-p,-w,-d,-i,-t?

我看到了许多运行perl代码或脚本的方法,有不同的标志。然而,当我尝试google的每个标志的意思,我主要获得结果到通用的perl网站,没有关于标志或其使用的具体信息。

下面是我最常遇到的标志,我不知道它们的意思:

> perl -pe
> perl -pi
> perl -p
> perl -w
> perl -d
> perl -i
> perl -t

如果你告诉我这些是什么意思和一些用例,或者至少告诉我一种找出它们的意思的方法,我将非常感谢。

解决方法

是的,Google臭名昭着的难以查找标点符号,不幸的是,Perl似乎主要是由标点符号组成:-)

命令行开关都详细在perlrun.(可以从命令行调用perldoc perlrun)

逐一简要介绍一下选项:

-p: Places a printing loop around your command so that it acts on each
    line of standard input. Used mostly so Perl can beat the
    pants off awk in terms of power AND simplicity :-)
-e: Allows you to provide the program as an argument rather
    than in a file. You don't want to have to create a script
    file for every little Perl one-liner.
-i: Modifies your input file in-place (making a backup of the
    original). Handy to modify files without the {copy,delete-original,rename} process.
-w: Activates some warnings. Any good Perl coder will use this.
-d: Runs under the Perl debugger. For debugging your Perl code,obvIoUsly.
-t: Treats certain "tainted" (dubIoUs) code as warnings (proper
    taint mode will error on this dubIoUs code). Used to beef
    up Perl security,especially when running code for other
    users,such as setuid scripts or web stuff.

原文地址:https://www.jb51.cc/Perl/173549.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐