use strict; use warnings; while () { # go through data line by line chomp; # don't forget to remove newline character my @fields = split /\t+/; print join "\t", # join fields with tab @fields[ 0, 2, 1 ], # select fields using array slice "\n"; } __DATA__ Col1 Col2 Col3 a b c 1 2 3