in reply to Succint Perl version of Awk

$ echo "one two three four five six seven eight nine A B C D E F G H A B C D E F G H I J" | awk '{ $1=$2=$3=""; print $0 }' four five six seven eight nine D E F G H D E F G H I J $ echo "one two three four five six seven eight nine A B C D E F G H A B C D E F G H I J" | perl -ale'$F[0]=$F[1]=$F[2]=""; prin +t "@F"' four five six seven eight nine D E F G H D E F G H I J
Naked blocks are fun! -- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re^2: Succint Perl version of Awk
by Galdor (Sexton) on May 30, 2023 at 06:41 UTC
    thanks for that...I had more or less come up with similar - but kept reverting to awk simply because it was shorter and easier to type (especially in cli pipes!) - the awk solution is very elegant compared to the Perl in this example - and Perl here, as ever, is capable...but in this case also cumbersome (atypical). Thanks for sample code..