I have a txt file like this:
#Genera columnA columnB columnC columnD columnN
x1 1 3 7 0.9 2
x2 5 3 13 7
There are command line switches that are used for this kind of application:
perl -lnae 'print join "\t", @F[1,3,5]' file.txt
Switch -a automatically creates variable @F for each line, split by whitespace. So @F[1,3,5] is an array slice of elements 1, 3, and 5.
The downside of this, of course, is that you have to use the column numbers instead of the names.