Well, this works for me.
use strict; use warnings; my $base=2; my $power=-12; my $number = $base * (10**$power); my $p = abs($power); my $string=sprintf("%.${p}f", $number); print $string;
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
In reply to Re^7: help with sprintf
by psini
in thread help with sprintf
by lil_v
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |