Help with variable reference in perl OOD
From: Tammer (tammer12_at_yahoo.com)
Date: 04/19/04
- Next message: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Previous message: Ian Giblin: "Re: Newbie: Where to install/put my own modules?"
- Next in thread: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Reply: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Apr 2004 12:37:38 -0700
I need to be able to set a variable equal to the value of an OOD
reference such that when the reference changes, the the variable
changes as well (usually accomplished with: $var = \$other_var), but
when I do this "$var" references the HASH entry for the object, not
its value stored. Ex:
#!/usr/bin/perl
$Data1 = object ("data");
print "$Data1->{'VAL'}\n";
$temp=\$Data1->{'VAL'};
print "$temp\n";
sub object {
my $objAddress={};
$objAddress->{'VAL'}=shift;
bless ($objAddress);
return ($objAddress);
}
If you run this bit of code the output is:
> temp
> SCALAR(0x40016c2c)
So clearly $temp isn't being assigned the value stored in
$Data1->{'VAL'}, which is what I want (and I want $temp to change with
$Data1->{'VAL'} changes). This is my first endeavor in perl OOD and
I'm stuck. Please help!
- Next message: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Previous message: Ian Giblin: "Re: Newbie: Where to install/put my own modules?"
- Next in thread: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Reply: Eric Bohlman: "Re: Help with variable reference in perl OOD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|