Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: extracting data from CSV files and making hash of hashes

by intel (Beadle)
on Jul 20, 2010 at 19:03 UTC ( [id://850491]=note: print w/replies, xml ) Need Help??


in reply to extracting data from CSV files and making hash of hashes

First of all, it would be helpful to see your input data.

I'm not very familiar with the CSV module, because parsing CSVs is something that Perl does very well natively.

Everything is fine up until the  my $csv = Text::CSV->new(); At that point you should probably be doing:

open (CSV, "<", $file) or die $!; my %subhash; for my $line ( split "\n" ) { my( $key, $value ) = split /\s+;\s+/, $line; $subhash{ $key } = $value; } $hash{ $subhash{ $file } } = \%subhash; }
This is nearly identical to a question answered by BrowserUK in this node: creating hash of hashes from input file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://850491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-25 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found