Blessed Perl monks, I've been on this problem for 6 hours now and I must submit. I need help. I'm trying to dereference a complex data structure and can't seem to figure it out. The data structure is referenced by a global variable: $IN Doing Data::Dumper($IN) yields:
$VAR1 = bless( { 'data_loaded' => 1, 'params' => {}, 'cookies' => { 'Community_Sesssion' => [ '68ce4195515 +b8040f9174503dacfe200' ], 'PHPSESSID' => [ 'e09347f6ca73f155b1fd +6500e92302b8' ], '__utmb' => [ '248415237' ], '__utmc' => [ '248415237' ], '__qcb' => [ '608960055' ], '__qca' => [ '1234223794-30138386-6175 +0767' ] }, 'p' => '', 'nph' => 0, '_debug' => 0 }, 'GT::CGI' );
What I'm trying to do is iterate through all the values of the cookies hash and do something with them. The last think I tried (out of about 100 other ways) is:
my %cookie_hash = $IN->{cookies}; foreach my $group (keys %cookie_hash) { print "The members of $group are\n"; foreach (@{$cookie_hash{$group}}) { print "\t$_\n"; } }
This outputs:
The members of HASH(0x828b958) are
Honestly, I'm stumped... Any help would be greatly appreciated.. Mike

In reply to Dereferencing my hash? by Anonymous Monk

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.