Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 chilling in the Monastery: (6)
As of 2014-09-17 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (57 votes), past polls