shoness has asked for the wisdom of the Perl Monks concerning the following question:
This will spin until hitting a line with an "extended" character, whereupon the CSV.pm will echo the offending line to STDERR and the program will die.#!/usr/bin/perl use strict; use warnings; use Encode; use Tie::Handle::CSV; my $dir = '.'; if (@ARGV > 0) { $dir = $ARGV[0]; } opendir DIR, $dir or die "Can't opendir '.': $!\n"; my @files = grep /\.csv$/i, readdir(DIR); closedir DIR; foreach my $file (@files) { my $csv = Tie::Handle::CSV->new(file => "$dir/$file"); while (my $line = <$csv>) { # do nothing, just loop... } }
The filehandle is opened within the module, so I can't get at it with binmode(). What am I to do?
Will all this go away if I just move all these files up to Unix where I have Perl 5.8.5 or thereabouts.
As always, your help is appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading CSV Files Containing UTF8 Characters
by Anonymous Monk on Nov 08, 2007 at 15:38 UTC | |
by shoness (Friar) on Nov 08, 2007 at 20:49 UTC | |
by graff (Chancellor) on Nov 09, 2007 at 04:31 UTC |