in reply to This looks like whitespace in my CSV but doesn't seem to be
You've got blurry vision
#!/usr/bin/perl -- use strict; use warnings; use Text::CSV; use Data::Dump; open my $io, '<', \q{ "My Company","Gavin","Henry ","ghenry@ghenry.co.uk"," 1.00" }; my $csv = Text::CSV->new( { binary => 1, eol => $/ } ); while ( my $row = $csv->getline($io) ) { my @fields = @$row; next unless $fields[4]; dd \@fields; $fields[4] =~ s/\s+//g; print $fields[4], "\n"; dd \@fields; } __END__ ["My Company", "Gavin", "Henry ", "ghenry\@ghenry.co.uk", " 1.00"] 1.00 ["My Company", "Gavin", "Henry ", "ghenry\@ghenry.co.uk", "1.00"]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: This looks like whitespace in my CSV but doesn't seem to be
by ghenry (Vicar) on Sep 30, 2012 at 08:27 UTC | |
by tobyink (Canon) on Sep 30, 2012 at 08:44 UTC | |
by ghenry (Vicar) on Sep 30, 2012 at 08:58 UTC | |
by ghenry (Vicar) on Sep 30, 2012 at 09:06 UTC | |
by Anonymous Monk on Sep 30, 2012 at 09:35 UTC | |
by Marshall (Canon) on Sep 30, 2012 at 10:12 UTC | |
by ghenry (Vicar) on Sep 30, 2012 at 12:40 UTC | |
by ghenry (Vicar) on Sep 30, 2012 at 08:42 UTC |
In Section
Seekers of Perl Wisdom