Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Perl hashes: is there some way of adding more data to the value associated with an existing key?

by mertserger (Curate)
on Jun 08, 2011 at 09:37 UTC ( #908668=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl hashes: is there some way of adding more data to the value associated with an existing key?
in thread Perl hashes: is there some way of adding more data to the value associated with an existing key?

Thanks to everyone for their replies.

As Daniel pointed out, the best way was to do this in the SQL, but I wasn't sure if you could. I have yet to find a website for SQL monks! However with Daniel's pointer I found the useful Oracle function wm_concat which does what I want to data and which I never knew about before.

You learn something every day and as always: there is more than one way to do things.


Comment on Re^2: Perl hashes: is there some way of adding more data to the value associated with an existing key?
Re^3: Perl hashes: is there some way of adding more data to the value associated with an existing key?
by onelesd (Pilgrim) on Jun 09, 2011 at 07:03 UTC
    TMTOWTDI: I like to think of awk as baby perl - a really fast baby.
    awk '{ seen[$1] = $2","seen[$1] ; } END { for (key in seen) { print key" "seen[key] ; } } ' /your/file.txt > /your/newfile.txt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://908668]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-08-01 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (8 votes), past polls