Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: Hashes of arrays populated from a Text File

by Laurent_R (Canon)
on Feb 26, 2014 at 19:05 UTC ( #1076302=note: print w/replies, xml ) Need Help??

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:
$ 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
The result is there even before you start populating your database.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076302]
[Corion]: marto: How's things? I hope the kids are fine and you too!
[Corion]: Oh yay. I wonder why a very simple change in a program doesn't elicit a diff, and now I see that my diff program seems to have a bug ;)
[1nickt]: marto thanks for asking, so far so good. A pretty modern stack and decent procedures, although rather too much home-built stuff (e.g. a logging role that should tries to duplicate Log::Any).
[Corion]: No. It's just that I'm comparing the same output file twice, instead of comparing the output files of the two runs %-)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2017-12-11 11:39 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (289 votes). Check out past polls.