So how do I assign value so that each time it is different value get assigned to the same key.
You'd use a second index. For instance:
my $count;
while (my $line = <IN>) {
chomp $line;
my($lastname, $firstname, $country, $language) = split(/\|/, $line
+);
$info{lastname}[$count] = $lastname;
$info{firstname}[$count] = $firstname;
$info{country}[$count] = $country;
$info{language}[$count] = $language;
$count++;
}
Or, (untested), do it all at once, and benefit fully from using strict:
my $LASTNAME = 0;
my $FIRSTNAME = $LASTNAME + 1;
my $COUNTRY = $FIRSTNAME + 1;
my $LANGUAGE = $COUNTRY + 1;
my @info = map {[/[^|\n]*/g]} <IN>;
Note that this reverses the role of the indices compared to my first suggestion -- and stores the row level data in arrays instead of hashes.