Gunnar Hjalmarsson wrote:
> Steve Bertrand wrote:
>> Is there a way that one can use sprintf on a variable and assign the
>> value back to the variable without having the leading $var= ?
>>
>> $var = sprintf ("%.2f", (($var /=1024) /=1024)))
> 
> You can write a function.
> 
>     convert( $var );
> 
>     sub convert { $_[0] = sprintf '%.2f', $_[0] / 2 ** 20 }

Thanks guys!

That's a neat piece of trickery that I'd never thought of!

Worked great!

Steve

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


Reply via email to