in reply to Re^2: One liner help
in thread One liner help

Nice. And golf it down with -E/say:
perl -anlF"/\./" -E"say join q{.},reverse@F" zones.txt

Replies are listed 'Best First'.
Re^4: One liner help
by kennethk (Abbot) on Oct 09, 2014 at 15:52 UTC
    Golf? -p and $_= save you one space over -n and say:
    perl -aplF"/\./" -E"$_=join q{.},reverse@F" zones.txt
    and a manual split takes less than -F (assuming you don't get flags for free):
    perl -lpE"$_=join q{.},reverse split/\./" zones.txt
    Using $, in place of join saves you 2, except then you lose $_=
    perl -lnE"$,=q{.};say reverse split/\./" zones.txt
    but you still win w/ a regex:
    perl -pE"s/(.+)\.(.+)\.(.+)/$3.$2.$1/" zones.txt
    and to me, that one seems a whole lot more obvious than the other offerings.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.