in reply to Re: Hashes of arrays populated from a Text File
in thread Hashes of arrays populated from a Text File
You must be kidding, sundialsvc4. Using a database for such a simple task is just plain overkill. You can obtain the desired result with just a simple Perl one-liner:
The result is there even before you start populating your database.$ cat test_file.txt Name1 1234 Name2 9999 Name1 5514 Name3 5415 Name2 6419 $ perl -ne 'my ($key, $val) = split; $hash{$key} .= " $val"; END { pri +nt "$_ => $hash{$_} \n" for keys %hash;}' test_file.txt Name3 => 5415 Name1 => 1234 5514 Name2 => 9999 6419
|
---|
In Section
Seekers of Perl Wisdom