>> $var = sprintf ("%.2f", (($var /=1024) /=1024)))
> 
> What the ...?!?
> 
> /= ?

It was an off the top of my head example of what I wanted to do. Without
being at the code at the time, I was simply thinking +=.

> You divide the value of $var by 1024, assign it back to $var, divide 
> it by another 1024, assign it again to $var, then format the 
> resulting number using sprinf() and assign it to $var?!? Why???

Why? Because I am not a professional, hence why I am asking at
'beginners' ;)

> $var = sprintf ("%.2f", $var / (1024*1024));

> And it will be more efficient because the multiplication will be done 
> at compile time (once) and you'll only do a single division each 
> time. 

I did not know that multiplication would be done at compile time. Is
this true for any mathematical equation that does not include a runtime
variable?

> Which is also more precise, though in this case it doesn't seem 
> to matter.

'twasn't about precision. It was a theoretical 'how can I do this?'.

I preferred Gunnar's answer as it let me offload it to a different
subroutine for use by other pieces of the module, only because I have a
few other type of equations of the same sort.

Thanks for your critique :)

Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to