sub foo { my ($foo) = @_; print($foo->{bar}, "\n"); } #### sub foo { my %foo = @_; print($foo{bar}, "\n"); } #### HV* hv = newHV(); SV* rv = newRV_noinc(hv); /* noinc to abandon our ref to the HV */ ... populate the hash using hv_store ... ... XPUSHs(sv_2mortal(rv)); /* Mortalize to abandon our ref to the RV */ ...