Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by Lady_Aleena (Chaplain)
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 making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2014-08-29 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (280 votes), past polls