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.

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...