【问题标题】:I get the following error when I use Perl interpreter with -e option [duplicate]当我使用带有 -e 选项的 Perl 解释器时出现以下错误 [重复]
【发布时间】:2020-01-15 16:03:15
【问题描述】:
C:\Windows\system32>perl -e 'print "Hello World\n"'
Can't find string terminator "'" anywhere before EOF at -e line 1.

【问题讨论】:

    标签: windows perl


    【解决方案1】:

    在 MSWin 上,单引号的行为与 *nix shell 不同。您需要双引号,对于内部,请使用 qq 运算符。

    perl -e "print qq(Hello World\n)"
    

    【讨论】:

    • 谢谢你成功了。为什么是QQ?
    • 为了避免需要转义嵌套的双引号。
    猜你喜欢
    • 1970-01-01
    • 2012-02-10
    • 2019-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多