String62 has asked for the wisdom of the Perl Monks concerning the following question:
COMPLETE CODE: -------------.......... foreach my $key (sort keys %$href) { print "Key: ".$key."\n"; # print "Key: ".$key." => Value: ".$href->{$key}."\n"; } ..........
use Inline C; $array_ref = get_data(); print "Array ref: ".$array_ref."\n"; $href = $array_ref->[0]; print "Hash ref: ".$href."\n"; foreach my $key (sort keys %$href) { print "Key: ".$key." => Value: ".$value."\n"; # print "Key: ".$key." => Value: ".$href->{$key}."\n"; } __END__ __C__ SV* get_data() { SV * x; AV * results; I32 nr = 0; int i, n; results = (AV *)sv_2mortal((SV *)newAV()); for (n = 0; n <= nr; n++) { HV * rh; STRLEN l; rh = (HV *)sv_2mortal((SV *)newHV()); hv_store(rh, "mickey", 6, "mouse", 0); hv_store(rh, "donkey", 6, "kong", 0); av_push(results, newRV((SV * )rh)); } return newRV((SV*)results); }
|
|---|