Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by Lady_Aleena (Deacon)
on Apr 19, 2012 at 06:53 UTC ( #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


Comment on Re: Can a single key have different value assigned to it
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://965877]
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: (9)
As of 2015-07-03 07:08 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 (48 votes), past polls