in reply to Re^5: Undef values from file open
in thread Undef values from file open
#!/usr/bin/perl use strict; use warnings; use Data::Dump 'pp'; use Data::Dumper; my $file_name = "file.csv"; open my $lines, '<', $file_name or die "Can't open file $file_name, $!"; my @parms = qw( date day name ); while (my $line = <$lines>) { next unless $line =~ /\S/; # <- add chomp $line; my $data; ( $data->{ date }, $data->{ day }, $data->{ name } ) = split(/,/, $ +line); pp @{ $data }{ (@parms) }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Undef values from file open
by poj (Abbot) on Mar 22, 2016 at 21:50 UTC | |
by Anonymous Monk on Mar 22, 2016 at 22:07 UTC | |
by AnomalousMonk (Archbishop) on Mar 23, 2016 at 03:06 UTC | |
by poj (Abbot) on Mar 22, 2016 at 22:33 UTC | |
by poj (Abbot) on Mar 23, 2016 at 08:29 UTC | |
by Anonymous Monk on Mar 22, 2016 at 22:44 UTC | |
|
Re^7: Undef values from file open
by AnomalousMonk (Archbishop) on Mar 22, 2016 at 21:42 UTC | |
by Anonymous Monk on Mar 22, 2016 at 23:19 UTC | |
by Anonymous Monk on Mar 22, 2016 at 22:10 UTC | |
by AnomalousMonk (Archbishop) on Mar 22, 2016 at 22:52 UTC |