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:
$_='"TEXT, DELIMITED,, STRING",1,2,3,4,5,6,7,"END"';
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
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:
$_='"TEXT, DELIMITED,, STRING",1,2,3,4,5,6,7,"END"';
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