(C) 2003, Tim Maher 1-35 www.TeachMePerl.com Perl as AWK Problem Print first two fields in reverse order Awk Solution awk '{ print $2, $1 }' F Perl Solution perl -wlna -e '($A,$B)=@F; # load fields print "$B $A"' F -wlna: -a auto- splits input into fields @F: field container, used by -a ($A,$B)=@F: copies field 1 into $A, 2 into $B