Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Can a single key have different value assigned to it

by Lady_Aleena (Priest)
on Apr 19, 2012 at 06:53 UTC ( [id://965877]=note: print w/replies, xml ) Need Help??


in reply to Can a single key have different value assigned to it

Hello, it looks like you may need to create an array of hashes, one hash for each $line. That way you get to keep all of your records.

my @information; open(IN,"<$file"); while(<IN>) { my $line = $_; chomp $line; my($lastname, $firstname, $country, $language) = split('\|', $line +); #print"$lastname, $firstname, $country, $language\n"; push @information, { 'lastname' => $lastname, 'firstname' => $firstname, 'country' => $country, 'language' => $language, } }

Update: I made a typo in the code, so I fixed it.

Have a cookie and a very nice day!
Lady Aleena

Log In?
Username:
Password:

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

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

    No recent polls found