> -----Original Message-----
> From: Michael Kelly [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 07, 2001 2:00 PM
> To: [EMAIL PROTECTED]
> Subject: Variable Recalculation
> 
> 
> Is there any way to recalculate a certain variable when 
> another variable's
> value changes? For instance if,
> 
> $a = 5;
> $b = $a * 4;
> $a = 10;
> 
> At the end of that, $a will be 10, but $b will still be 20 (5 
> * 4).  Is
> there any way, short of manually recalculating $b every time $a might
> change, to have $b set to 40 when $a is set to 10? I know I 
> could just do
> something like:
> 
> print $a * 4, "\n";
> 
> instead of 
> 
> print "$b\n";
> 
> But with a large set of variables like this that are used 
> quite often, this
> method is rather slow and error-prone.
> 
> I've tried to do this with references, but I've had no luck.

In addition to Jeff's suggestions,

   perldoc overload

will give you all the rope you need to hang yourself.

It might be better if you told us more about what you're actually trying to
do here...

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

Reply via email to