Then I guess the real question is why you are declaring two variables that
you want to be concurrently updated when you can just use one.

-----Original Message-----
From: Tim Yohn [mailto:tyohn@;alabanza.com]
Sent: Thursday, November 07, 2002 10:19 AM
To: Timothy Johnson
Subject: Re: Population of variables in hash values...


Nope,

No typo, this is exactly what I am trying to accomplish... I want the
hash to store the variable (and thus be able to reference that variable
and it's current value later on) and not the value of the variable.  You
are correct in the fact that it does not work that way as I posted it,
that's why I asked how to do it.

Tim.

On Thu, 7 Nov 2002 09:38:48 -0800 
Timothy Johnson <[EMAIL PROTECTED]> wrote:

> 
> I don't see how that could possibly work, since you are declaring the
> value of $hash{1} to be $domain, which has not been initialized.  You
> are declaring $hash{1} to be the VALUE of $domain.  When you change
> $domain later, this won't update your hash retroactively.  Maybe this
> is just a typo in your post?
> 
> -----Original Message-----
> From: Tim Yohn [mailto:tyohn@;alabanza.com]
> Sent: Thursday, November 07, 2002 9:13 AM
> To: [EMAIL PROTECTED]
> Subject: Population of variables in hash values...
> 
> 
> Hey All,
> 
> Is there an easy way to have variables in the value of a hash that are
> not populated until the value of the hash is used... for example:
> 
> my($domain);
> my(%hash) = (
>       1 => "$domain"
> );
> 
> print_domain("test.com");
> 
> sub print_domain() {
>       my($domain) = @_;
> 
>       print $hash{'1'};
> }
> 
> What ends up happening is the printing of a null string (I understand
> why since $domain didn't contain a value when the hash was initially
> populated)... however what I would like to have happen is the $domain
> value of the hash be populated when it is called in the sub, thus
> printing "test.com".  I've tried references in the hash (i.e. 1 =>
> "\$domain") however then I just received the SCALAR(memaddr) as
> output. Any suggestions that might help point me in the right
> direction would be greatly appreciated.
> 
> Thanks,
> Tim.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to