# Copy only the desired fields to create a new # line in TSV format # This can be done in one simple step in Perl, using # list slices and the join() function my $new_line = join "\t", ( split /\t/, $_ )[ 2, 3, 12 .. 18, 25 .. 28, 31 ]; # ...