Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Dynamically map the elements of CSV

by izut (Chaplain)
on May 29, 2006 at 14:30 UTC ( [id://552314]=note: print w/replies, xml ) Need Help??


in reply to Dynamically map the elements of CSV

I think this is what you want:
my @entries; my @keys; while ($_ = <DATA>) { if ($. == 0) { # first line @keys = split /;/; next; } my %data; $data{@keys} = split/;/; push @entries, \%data; }

Update: updated some code errors.

Igor 'izut' Sutton
your code, your rules.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (None)
    As of 2024-04-25 00:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found