Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Perl-ish way to create hash from array

by tangent (Curate)
on Jul 09, 2013 at 19:14 UTC ( #1043364=note: print w/ replies, xml ) Need Help??


in reply to Perl-ish way to create hash from array

Maybe I'm not understanding your question but you can use Text::CSV to give you a hash reference directly:

# figure out the column headings from the first line my $headrow = $csvParser->getline($csvHandle); # tell the parser to use those headings as hash keys $csvParser->column_names($headrow); while ( my $hash = $csvParser->getline_hr($csvHandle) ) { print "Column Foo has value $hash->{Foo}"; }


Comment on Re: Perl-ish way to create hash from array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-07-08 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls