Jeffrey Friedl <jfriedl@yahoo.com> writes: >Does anyone know why the code to take a reference of a hash's key, > > \$hash{KEY} > >results in the MOD flag on to the 'helem' at #6 below: I assume because someone could be assigning via the refrerence: sub foo { my $ref = shift; $$ref = 'bar; } foo(\$hash{KEY}); In such cases one would need the slot to exist so that a reference to the SV * could be passed. > > > { > 7 TYPE = srefgen ===> 8 > FLAGS = (VOID,KIDS) > { > TYPE = null ===> (7) > (was list) > FLAGS = (LIST,KIDS,REF,MOD) > { > 6 TYPE = helem ===> 7 > FLAGS = (SCALAR,KIDS,REF,MOD) > { > 4 TYPE = rv2hv ===> 5 > FLAGS = (SCALAR,KIDS,REF) > { > 3 TYPE = gv ===> 4 > FLAGS = (SCALAR) > GV = main::hash > } > } > { > 5 TYPE = const ===> 6 > FLAGS = (SCALAR) > PRIVATE = (BARE) > SV = PVIV("KEY") > } > } > } > > > >This ends up fetching the value for {KEY} by calling > Perl_hv_fetch_ent >with the 'lval' flag true, which makes it appear to be an assignment >to that key, which is confusing me.... > >Thanks, > Jeffrey -- Nick Ing-Simmons http://www.ni-s.u-net.com/Thread Previous | Thread Next