How to view the code block genereated by n or p switch in perl one liner

后端 未结 2 1560
后悔当初
后悔当初 2020-12-18 11:05

I am sure I have run this before but for the life of me cant find any reference in perlrun or through Google. Hopefully some of the perl boffins here will be able to answer

相关标签:
2条回答
  • 2020-12-18 11:35

    Try

    perl -MO=Deparse -ne 'print if /^00/'
    

    It will give you the output like this:

    LINE: while (defined($_ = <ARGV>)) {
        print $_ if /^00/;
    }
    -e syntax OK
    
    0 讨论(0)
  • 2020-12-18 11:45

    You may be thinking of the B::Deparse function:

    perl -MO=Deparse -ne 'print if /^00/'
    
    0 讨论(0)
提交回复
热议问题