in reply to Stripping a seemingly complicated comma-delimited file

Let's start with an example that you can take and adapt to fit your comma-separated datafile. Download (use link at bottom of this node) or cut & paste this code & adapt it. Here's an example of parsing a file containing 3 comma-delimited fields:
#!perl -w use strict; open(FILE, "< csv_filename") or die "Couldn't open file, $!"; while(<FILE>) { chomp; # Remove the newline my ($var1, $var2, $var3) = split /,/; print $var1," ",$var2," ",$var3,"\n"; } exit;
We can move on to what you want to do next after you get past reading the file & parsing each line successfully.

Replies are listed 'Best First'.
Re: Re: Stripping a seemingly complicated comma-delimited file
by jamesSA (Initiate) on Jun 11, 2001 at 18:17 UTC
    thanks i was an idiot ... i forgot chomp :)