in reply to Succint Perl version of Awk

TIMTOWTDI:
perl -lane '@F[0,1,2] = ("") x 3; print "@F"' perl -lane 'splice @F, 0, 3, ("") x 3; print "@F"'
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Succint Perl version of Awk
by ikegami (Patriarch) on May 31, 2023 at 01:01 UTC

    Taking advantage that the warnings are off:

    perl -lane'@F[0..2] = (); print "@F"'

    Golfed:

    perl -pale'$_=" @F[3..$#F]"'

    Note that these solutions, like those in the parent, don't "lose the first three columns". They just replace their values with blanks. Just like the awk program does. If you truly want to remove the leading columns (i.e. no leading spaces in the output), then you can use

    perl -pale'$_="@F[3..$#F]"'
Re^2: Succint Perl version of Awk
by Galdor (Sexton) on May 30, 2023 at 10:14 UTC
    LOL - thaksf or your intransigence! it has been noted and appended to my Perl scrapbook... :)