http://www.perlmonks.org?node_id=908668


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.

Replies are listed 'Best First'.
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