游.程 2011-06-10 04:38 采纳率: 0%
浏览 200
已采纳

Perl flags-pe-pi-p-w-d-i-t?

I have seen lots of ways of running Perl code or scripts, with different flags. However, when I try to google for what each flag means, I mainly get results to generic Perl sites and no specific information regarding the flags or their use is found there.

Below are the flags that I encounter most often, and I don't have a clue what they mean:

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

I will be very grateful if you tell me what each of those mean and some use cases for them, or at least tell me a way of finding out their meaning.

转载于:https://stackoverflow.com/questions/6302025/perl-flags-pe-pi-p-w-d-i-t

  • 写回答

4条回答 默认 最新

  • ~Onlooker 2011-06-10 04:41
    关注

    Yes, Google is notoriously difficult for looking up punctuation and, unfortunately, Perl does seem to be mostly made up of punctuation :-)

    The command line switches are all detailed in perlrun. (available from the command line by calling perldoc perlrun)

    Going into the options briefly, one-by-one:

    -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 :-)
    -n: Places a non-printing loop around your command.
    -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.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘