V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
sinux
V2EX  ›  Perl

新手学 perl,想问一下 print 数字的时候,为什么后面总是跟着一个“%”

  •  
  •   sinux · May 8, 2015 · 9326 views
    This topic created in 4007 days ago, the information mentioned may be changed or developed.
    终端是zsh。
    2 replies    2015-05-27 23:10:14 +08:00
    batman2010
        1
    batman2010  
       May 9, 2015
    perl -e "print 1"
    bash 下没有问题。
    hsh
        2
    hsh  
       May 27, 2015
    首先perl -e "print 1"这种用法不对。查看perl的man手册,看到 -e | -E 'command'这种形式才是正确的,所以应该使用perl -e 'print 1'。
    如果要输出字符串应使用这种形式:perl -e 'print "Hello, perl!\n"'。
    请在命令行执行perldoc perlrun(这两个命令同时输入,并且中间有空格,然后回车),
    将会看到关于 -e 和 -E选项的说明。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   940 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:39 · PVG 05:39 · LAX 14:39 · JFK 17:39
    ♥ Do have faith in what you're doing.