[ale] Parsing CSV file in perl

Fletch fletch at phydeaux.org
Fri Jul 8 09:22:53 EDT 2005


>>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:

    Christopher> I'm trying to parse a CSV file in perl and I'm having
    Christopher> a issue with some of the columns being blank.

Install Text::CSV_XS and then try something like:

use Text::CSV_XS ();

my $csv = Text::CSV_XS->new( { sep_char => "\t", } );

while( <> ) {
  chomp;
  my $status = $csv->parse( $_ );
  my @cur = $csv->fields;

  ## ...
}

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org|  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list