Hi folks

The problem was that the files I'm reading are generated on M$ servers in DOS 
format.

This meant that at the end of the file is a line containing the DOS EOF char 
^Z.  Using grep to remove this before reading the file has fixed the problem.

The error's gone and my program continues as it should.

Thanks for your help.

Gary

On Wednesday 27 June 2007 19:49, Chas Owens wrote:
> On 6/27/07, Jay Savage <[EMAIL PROTECTED]> wrote:
> snip
>
> > Make sure that the last record in your file is correctly terminated
> > (i.e. there are no unclosed quotes), and that the last record is
> > followed immediately by the final newline, which is alos the last
> > character of the file.
>
> snip
>
> Try applying the following patch against
> $YOUR_PERL_DIR/Tie/Handle/CSV.pm.  It extends the error message on a
> bad parse to make it more readable.
>
> --- CSV.pm.bak  2007-06-27 14:39:54.000000000 -0400
> +++ CSV.pm      2007-06-27 14:46:10.000000000 -0400
> @@ -151,7 +151,7 @@
>        if (defined $csv_line)
>           {
>           $opts->{'csv_parser'}->parse($csv_line)
> -            || croak $opts->{'csv_parser'}->error_input();
> +            || croak "could not parse: [" .
> $opts->{'csv_parser'}->error_input() . "]";
>           if ( $opts->{'header'} )
>              {
>              my $parsed_line = $opts->{'simple_reads'}

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to