Re: Variable division, assignment and sprintf in one line
- From: noreply@xxxxxxxxx (Gunnar Hjalmarsson)
- Date: Wed, 28 Nov 2007 20:55:05 +0100
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 }
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- Follow-Ups:
- Re: Variable division, assignment and sprintf in one line
- From: Steve Bertrand
- Re: Variable division, assignment and sprintf in one line
- References:
- Variable division, assignment and sprintf in one line
- From: Steve Bertrand
- Variable division, assignment and sprintf in one line
- Prev by Date: Re: Variable division, assignment and sprintf in one line
- Next by Date: Re: fixed list combinatorics
- Previous by thread: Re: Variable division, assignment and sprintf in one line
- Next by thread: Re: Variable division, assignment and sprintf in one line
- Index(es):