$inputfile1 =~ s/\s*\z//;
$inputfile1 is your filehandle, but you are editing that filehandle and thus corrupting it. Try:
sub mainCSV { open (my $inputfile1, '<', "$inputfile") or die "Unable to open $i +nputfile1: $!"; my %hash; while( my $line = <$inputfile1> ) { $line =~ s/\s*\z//; my @arrayfile1 = split /,/, $line; my $keyfile1 = shift @arrayfile1; $hash{$keyfile1} = \@arrayfile1; } print %hash; close $inputfile1; }
In reply to Re: csv to hash table
by BrowserUk
in thread csv to hash table
by waytoperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |