On Tue, 13 Nov 2001, AMORE,JUAN (HP-Roseville,ex1) wrote:

> How do I update the value pointed to by key "PAGER" from more to pg.
> when using a reference only to the hash element for key "PAGER".
>
>
> %Unix= ("SHELL" => "/bin/csh",
>    "PAGER" => "more",
>    "DB" => "mysql");
>
>  print "Value: ", $unix{PAGER};
>
>


Are you saying that you have a reference to the hash itself, or a
reference to the scalar element stored in the hash?  See below:

my %hash = ( SHELL => '/bin/csh' );
my $rh_hash = \%hash;
my $rs_element = \($hash{SHELL});

print $hash{SHELL}, "\n";

$rh_hash->{SHELL} = 'blog';
print $hash{SHELL}, "\n";

$$rs_element = 'wurzle';
print $hash{SHELL}, "\n";


Outputs:

/bin/csh
blog
wurzle




Dave



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to