in reply to Adding a column to a file where i took out two columns
If you are open to "other" viewpoints, I'd say that using DBD::CSV (with "\t" as csv_sep_char) will make your task very easy using SQL commands.