Couldn't get your code, or ikegami's to work for me ... not sure why. (Update: Nothing wrong with ikegami's code, of course. Looks to me that $value in the op's code bears no relation to the hashref that has been returned and therefore is undef.)

The following *does* work for me, and should contain all you need to get your own code working:
use Inline C => Config => BUILD_NOISY => 1; use Inline C; $arref = get_data(); print $arref, "\n"; print $arref->[0]->{mickey}, "\n"; print $arref->[0]->{donkey}, "\n"; __END__ __C__ SV* get_data() { AV * results; HV * rh = newHV(); results = newAV(); hv_store(rh, "mickey", 6, newSVpv("mouse", 0), 0); hv_store(rh, "donkey", 6, newSVpv("kong", 0), 0); av_push(results,newRV_noinc((SV*)rh)); return newRV_noinc((SV*)results); }
Update: The 'BUILD_NOISY' config option that I've included in the above script ensures that you get the opportunity to see compiler warnings - which can be useful if a script does not behave as intended. It's a good idea to *always* have BUILD_NOISY switched on.

Cheers,
Rob

In reply to Re: Inline C : dereferencing array of hash references returned from function by syphilis
in thread Inline C : dereferencing array of hash references returned from function by String62

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.