brianbrittain has asked for the wisdom of the Perl Monks concerning the following question:

Gang - I have a flat file with 3 rows and 5 columns that are tab delimited. Using tie, I have a created a two dimensional array pointing to the file. The names of the columns are in the first row. The columns are tab delimited.
Make Model Year Color Doors Ford Focus 2006 Red 4 LndRvr Discovery 2004 Gray 4
How do I delete the 3rd column (year), which would leave me 3 rows and 4 columns in the file? Thanks!

Replies are listed 'Best First'.
Re: Removing a Column from a Two Dimensional Array (via tie)
by ccn (Vicar) on Nov 05, 2008 at 05:25 UTC

    perl -lape '$_ = join "\t", @F[0,1,3,4]' file > newfile
      See also -F. -F/\t/ is needed if any of the columns can contain a space, such as in the line "Pontiac\tGrand Am\t2004\tGreen\t2\n".