p6steve has asked for the wisdom of the Perl Monks concerning the following question:
#Read all transactions my $lref; my $line = ''; my @fields = (); my @alltrans = (); open( ALL, "<alltrans.csv" ) or die "can't open alltrans.csv"; while( <ALL> ) { chomp; $line = $_ . ' '; #ugly as only copes with one trailing null fi +eld @fields = split( ',', $line ); $fields[-1] = ( $fields[-1] eq ' ' ) ? '' : $fields[-1]; $lref = [ @fields ]; push( @alltrans, $lref ); } close ALL; print Dumper @alltrans;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split Trailing Nulls
by delirium (Chaplain) on Feb 07, 2004 at 15:00 UTC | |
|
Re: Split Trailing Nulls
by Roger (Parson) on Feb 07, 2004 at 13:25 UTC |