I see. You want the output to look something like this:
$ perl -e 'for(my $total = 24.15; $total <30000; $total *= 10) {
printf("Total:%10s\n", "\$" . sprintf("%.2f",$total)) ;} '
Total: $24.15
Total: $241.50
Total: $2415.00
Total: $24150.00
Not sure if there is a better way. My guess is that there is probably
some module to convert float to currency and then print it as a
string. But a quick Google didn't turn up anything.
Good luck and let us know how things go.
Regards,
- Robert
On Mon, Oct 26, 2009 at 11:57 AM, Bryan R Harris
<[email protected]> wrote:
> Is there a way to do this without getting all messy like this?
>
> printf "Total:%10s\n", "\$".sprintf(%.2f,$total);
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/