I am reading in data from a db trying to reconstruct a hash which has a hash reference in it. What I'm getting is a hash with an anonymous hash in it rather than a hash reference, I believe.
How do I get the right data structure? Here is what the data looks like printed: -- What I Get (BAD) -- [print_rnd_line](^!rob),swares,swares!chatzilla@pendulum-A127A504.wecm +.ibm.com,ARRAY(0x9a9e090),#bots2,{ 'file' => '/home/issuebot/data/rob.txt', },!rob -- What I Need (GOOD) -- [print_rnd_line](^!rob),swares,swares!chatzilla@pendulum-A127A504.wecm +.ibm.com,ARRAY(0x9ab13c8),#bots2,HASH(0x9a4ad0c),!rob [Hal] Got Text [!rob] Here is a code snippet of the offending code: while ((@row) = $sth->fetchrow_array) { $line= join(";", map {defined $_ ? $_ : "(null)"} @row); ($id, $name, $command, $reply_to, $listen_on, $requires, $help +, $description, $sub_name, $args, $sub_code, $whenactive, $enabled, $ +subscribed)=split /;/,$line; print "[load_plugins] Config $id, $name, $command, $reply_to, +$listen_on, $requires, $help, $description, $sub_name, $args, $sub_co +de, $whenactive, $enabled, $subscribed\n"; # subscriber handler my (@subscribed) = split /[\s|\n]+/, $subscribed; foreach my $subscrber (@subscribed){ if ($subscrber =~ /$identity_id/){$subscribed="true";last} +; } if ($subscribed !~ /true/){next}; if ($enabled =~ /true/){ # fix $args hash ref # $args needs to be a reference $public_handlers{"$name"} = ( { id => $id, name => "$name", command => "$command", reply_to => "$reply_to", listen_on => "$listen_on", requires => "$requires", help => "$help", description => "$description", sub => "$sub_name", args => "$args", sub_code => "$sub_code", whenactive => "$whenactive", enabled => "$enabled", }, );

In reply to Need a hand with rebuilding hashes out of a db. by swares

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.