GertMT has asked for the wisdom of the Perl Monks concerning the following question:
The following code that I use to import some csv file works okay if I do not use
Thanks for your reply,
Gert
However I get warnings ("uninitialized value") if I'm trying to code the right way. Can someone point me further in the right direction?#!/usr/bin/perl -w use strict;
Thanks for your reply,
Gert
with data: data.txt#!/usr/bin/perl -w use IO::File; use Text::CSV_XS; my $csv = Text::CSV_XS->new( { sep_char => ',' } ); my $io = IO::File->new( 'data.txt', '<' ) or die "Can't read file: $!\n"; my $number = 10; # which number to start with? until ( $io->eof ) { my $row = $csv->getline($io); print "Olah:","\t", $number++ , "\t", $row->[2], " ", "\"", $row->[5], "\"", "\t", "\"", $row->[3], $row[0], "\"", " ", $row->[4], "\n"; }
"123",20090626,14,"P8","Ba",20090626,"BET 98" "123",20090626,74,"P2","Ba",20090626,"BET 08" "123",20090626,47,"03","Av",20090626,"f: 29" "123",20090626,40,"10","Av",20090626,"ok" "123",20090629,17,"07","Go",20090629,"Sa"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problem when - use strict and -w
by moritz (Cardinal) on Jul 14, 2009 at 20:38 UTC | |
Re: Problem when - use strict and -w
by ikegami (Patriarch) on Jul 14, 2009 at 21:44 UTC | |
by GertMT (Hermit) on Jul 15, 2009 at 03:22 UTC | |
by ikegami (Patriarch) on Jul 15, 2009 at 05:08 UTC | |
by GertMT (Hermit) on Jul 15, 2009 at 10:15 UTC | |
by ikegami (Patriarch) on Jul 15, 2009 at 13:59 UTC | |
by Anonymous Monk on Jul 15, 2009 at 10:43 UTC | |
| |
Re: Problem when - use strict and -w
by toolic (Bishop) on Jul 14, 2009 at 20:42 UTC | |
by GertMT (Hermit) on Jul 14, 2009 at 21:14 UTC | |
by toolic (Bishop) on Jul 14, 2009 at 21:30 UTC | |
Re: Problem when - use strict and -w
by roboticus (Chancellor) on Jul 15, 2009 at 04:05 UTC |
Back to
Seekers of Perl Wisdom