Guo Yixuan on 2 Dec 2015 21:26:02 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] perl -MO=Deparse




On Wed, Dec 2, 2015 at 6:01 PM, JP Vossen <jp@jpsdomain.org> wrote:
>
> I don't know how I've missed this, but I have.  I love Perl one-liners,
> but I never knew you could "deparse" them!
>
> -----
> $ perl -MO=Deparse -a -F/:/ -ne 'print "$F[2]\t$F[0]\t$F[6]";'
> /etc/passwd | head -n4
> -e syntax OK
> LINE: while (defined($_ = <ARGV>)) {
>     our(@F) = split(/:/, $_, 0);
>     print "$F[2]\t$F[0]\t$F[6]";
> }
>
> $ perl -a -F/:/ -ne 'print "$F[2]\t$F[0]\t$F[6]";' /etc/passwd | head -n4
> 0       root    /bin/bash
> 1       daemon  /usr/sbin/nologin
> 2       bin     /usr/sbin/nologin
> 3       sys     /usr/sbin/nologin
> -----
>
> Later,
> JP
> --  -------------------------------------------------------------------
> JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/

It is indeed nice, with document on the options in:
$ perldoc B::Deparse

Regards,
Yixuan
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug