I am having trouble even asking this : ) I have two tables which look like this:

Table1: act1 | act2 | act3 | act4 _________________________ 1,2 | 3,2 | 6 | 2,8 Table2: id | name _________ 1 | foo 2 | bar 3 | this 6 | that 8 | hey
i want to grab the into from table1, resolve each member of the list and get the name assoc. with it, and then print out the info like:
1 : act1 2 : act1, act2, act4 3 : act2 6 : act3 8 : act4
I tried and failed four times, I keep getting a bunch of ARRAY(XXXXXX) stuff and I am clueless as to why here is the code i tried:
$req_cert_info->execute("$TRANS_ID") or dienice("344 Couldn't execute statement $TRANS_ID : " . $get_info-> +errstr); my %seen; while ( my $ref = $req_cert_info->fetchrow_hashref ) { foreach my $key ( keys %$ref ) { next if ( $key eq "TRANS_ID" ); if ( $ref->{$key} ) { my @prod_ids = split ",", $ref->{$key}; foreach my $prodid ( @prod_ids ) { my $prod; if ( exists $seen{$prodid} ) { $prod = $seen{$prodid}; } else { my $prod = $dbh->selectrow_array("SELECT PRODUCT F +ROM SC_PRODUCT WHERE PRODUCT_ID = $prodid"); push @{$seen{$prodid}}, $prod; } push @{$services{$prod}}, $key; } } } } $req_cert_info->finish; foreach my $product ( keys %services ) { print "<TR><TD>@{$product}</TD><TD>@{$services{$product}}</TD><TD> +checkbox</TD></TR>"; }

I hope this is clear enough - I think part of the problem is I am so unclear on it myself. I thank anymonk who can help : )

-- I'm a solipsist, and so is everyone else. (think about it)


In reply to reversing a hash -- printing it by jptxs

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.