Direct Reference Techniques
#!/usr/local/bin/perl
$var = "AnyThing";
#Save address of scalar variable $var
$ref = \$var;
#Dereference $ref printing value of $var
print "Value = $$ref\n";
#Save address of scalar $ref, itself a reference
$doubleRef = \$ref;
#Dereference $doubleRef, then dereference contained reference
print "Double Reference Value = $$$doubleRef\n";
#Save address of scalar $doubleRef, itself a reference
$tripleRef = \$doubleRef;
#Dereference $tripleRef, then dereference contained references
print "Triple Reference Value = $$$$tripleRef\n";
Related examples in the same category