Re: Updating a hash using a refernece?
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]
Updating a hash using a refernece?
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}; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Updating a hash using a refernece?
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}; $unix{PAGER} = 'foo'; see perldoc perldata for more info... Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]