Here is the data in very simple form
$VAR1 = { '_LFOGH4MI5' => [ '_LFOGH4MI5', '201200260', 'Software Extraction Util', 'Jane Smith', 'Closed', 'Database Query', 'email1@email.com', 'email2@email.com' ], '_W9E2B5DBZ' => [ '_W9E2B5DBZ', '201200261', 'TEST: Another test to test the testy thin +g', 'Mike Jones', 'Closed', 'HIP', 'email1@email.com', 'email2@email.com' ] }; $VAR1 = [ [ '_LFOGH4MI5', '<P>Where is the extraction utily for the console database +?.</P>', '<P>I uploaded it to our website for you to download.</P>' ], [ '_W9E2B5DBZ', '<P>Problem2</P>', '<P>Res2</P>' ], [ '_W9E2B5DBZ', '<P>Problem 1- teest</P>', '<P>Res1 - teest</P>' ], [ '_W9E2B5DBZ', '<P>Prob3</P>', '<P>res3</P>' ] ];

So, I have a hash with the unique ID as it's key. In another part of the database is another table with problems/resolutions attached to the same unique ID. That is contained in the array (in array references). Each array has the unique ID in it first element.

What I would like to do is start on that hash and take it's key. The run through the array and anywhere I get a match for the same ID push the rest of the array into the original value of the hash. In some cases, like above, there might be many arrays with the same ID (loads of problems/resolutions attached to the same case).

I'd really appreciate any help, my head is set to burst!
BTW, I have tried to lump the data together at the SQL end but datatype differences are stopping me grouping them there.

EDIT: Hash should end up like:

'_LFOGH4MI5' => [ '_LFOGH4MI5', '201200260', 'Software Extraction Util', 'Jane Smith', 'Closed', 'Database Query', 'email1@email.com', 'email2@email.com' '<P>Where is the extraction utily for the c +onsole database?.</P>', '<P>I uploaded it to our website for you to download.</P>' ], '_W9E2B5DBZ' => [ '_W9E2B5DBZ', '201200261', 'TEST: Another test to test the testy thin +g', 'Mike Jones', 'Closed', 'HIP', 'email1@email.com', 'email2@email.com' '<P>Problem2</P>', '<P>Res2</P>' '<P>Problem 1- teest</P>', '<P>Res1 - teest</P>' '<P>Prob3</P>', '<P>res3</P>' ] };

In reply to Re^2: Comparing Hash key with array by packetstormer
in thread Comparing Hash key with array by packetstormer

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.