Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text::CSV issues

Status
Not open for further replies.

parkers

Vendor
Oct 21, 2002
157
GB
Hi,

I've just installed the Text::CSV module ( for manipulating CSV files ... I'm having a problem utilising the $_ variable correctly with the Text::CSV functions ... my code snippet is as follows:

open (FILE,$file) or die ("Unable to open file");
while (<FILE>)
{
chomp $_;
$status = $csv->parse($_);
@columns = $csv->fields;
print @columns; # for test purposes
}
close (FILE);

Absolutely nothing is bound to @columns array however if I substitute the following after the chomp the code works OK:

$_='&quot;TEXT, DELIMITED,, STRING&quot;,1,2,3,4,5,6,7,&quot;END&quot;';

I've checked for file existence, permissions and data by printing each line of the file to screen as it reads so there should be no problem there.

Is there something stupid I'm missing here or has anyone any ideas?

Thanks,
SP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top