in reply to Re^2: scalar ref losing it's value?
in thread scalar ref losing it's value?

$UIDholder is just a variable name. If you want a reference to it, you do this:
my $UIDholder = "some value"; my $var_ref = \$UIDholder; print "UIDHolder: $UIDholder\n"; print "reference: $var_ref\n";

This gives the output:
UIDholder: some value reference: SCALAR(0x8160e8c)

Note that the memory location of your reference may be different from mine. SCALAR indicates the type of variable the reference points to.
To use the reference, you have to 'dereference' it. For instance, to print the actual value the variable holds by using the reference instead of the variable name, throw an extra $ sign in front of the $var_ref variable name:
print "Actual value of variable: $$var_ref\n";


I hope this helps.


"Peace, love, and Perl...well, okay, mostly just Perl!" --me

Apprentice

Replies are listed 'Best First'.
Re^4: scalar ref losing it's value?
by jck (Scribe) on May 05, 2006 at 18:51 UTC
    thank you - that does help (i knew the concept, i was just getting hung up on the words)...