develooper Front page | perl.perl5.porters | Postings from July 2001

taking a reference is an assignment?

Thread Next
From:
Jeffrey Friedl
Date:
July 28, 2001 12:23
Subject:
taking a reference is an assignment?
Message ID:
200107281922.MAA26090@ventrue.corp.yahoo.com

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:


		{
	    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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About