Greetings all. I am new to the site (at least as a registered user), but plan to step up my attendance here as I am writing more and more Perl these days. Here is my question and I hope someone out there has a solution for me.

Here is what I currently have, in a hash:

%hash= ( Group1 => 'ATG1,ATG2,ATG4,ATRG7', Group2 => 'ATG1,ATG9', Group3 => 'FYCO1,LSM2' );

What I would like to do is end up with something like this:
newGroup1 = ATG1,ATG2,ATG4,ATRG7,ATG9
newGroup2 = FYCO1,LSM2

Basically, if a value from 1 group (key) is found as a value from another group then I want to combine the values from both of those groups into a single set of values. I hope that makes sense. I've been working on this for a couple of days now and can't figure a good way to do it. :)

Thanks for any help! Glad to be a part of this site now.
-Mat


In reply to Should I use a hash for this? by awos22

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.