#!usr/bin/perl -w use strict; # open the file that has to be read open(my $in, "filename.txt"); #open a new file which has to be made open (my $out, ">result.txt"); #In the while loop, put the columns that have to be printed in the new file. while(<$in>){ my @fields = split /\t/; my $SAMPLE_NAME = $fields[1]; my $SIZE = $fields[3]; #print the columns { print $out "$SAMPLE_NAME\ $SIZE\n"; } } close the filehandles close($in); close($out);