Perl风格:改变过路兵

  • 您可以一次性复制并更改所有内容

        chomp($answer = <TTY>);
    
        ($a += $b) *= 2;
    
        # strip to basename
        ($progname = $0)        =~ s!^.*/!!;
    
        # Make All Words Title-Cased
        ($capword  = $word)     =~ s/(\w+)/\u\L$1/g;
    
        # /usr/man/man3/foo.1 changes to /usr/man/cat3/foo.1
        ($catpage  = $manpage)  =~ s/man(?=\d)/cat/;
    
        @bindirs = qw( /usr/bin /bin /usr/local/bin );
        for (@libdirs = @bindirs) { s/bin/lib/ }
        print "@libdirs\n";
      | /usr/lib /lib /usr/local/lib
    

跳转到 负数组下标
返回 拥抱模式匹配
返回 索引

版权 © 1998, Tom Christiansen 版权所有。

标签

反馈

这篇文章有什么问题吗?请在GitHub上打开一个问题或拉取请求来帮助我们