Re: printf with currency symbols

2009-10-26 Thread Bryan R Harris
> Robert Citek wrote: >> 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. > > Here' why (extracted from `perldoc perllocale`): > >Category LC_MONET

Re: printf with currency symbols

2009-10-26 Thread Shawn H Corey
Robert Citek wrote: > 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. Here' why (extracted from `perldoc perllocale`): Category LC_MONETARY: Formattin

Re: printf with currency symbols

2009-10-26 Thread Robert Citek
I see. You want the output to look something like this: $ perl -e 'for(my $total = 24.15; $total <3; $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

Re: printf with currency symbols

2009-10-26 Thread Robert Citek
Is this what you are looking for: $ perl -e '$total = 24.15 ; printf "Total: \$%.2f\n", $total; ' Regards, - Robert On Mon, Oct 26, 2009 at 11:57 AM, Bryan R Harris wrote: > Is there a good way to do printf's with currency symbols? > > I've tried this: > >  printf "Total: \$%10.2f\n", $total; >

Re: printf with currency symbols

2009-10-26 Thread Jim Gibson
On 10/26/09 Mon Oct 26, 2009 8:57 AM, "Bryan R Harris" scribbled: > > > Is there a good way to do printf's with currency symbols? > > I've tried this: > > printf "Total: \$%10.2f\n", $total; > > But it puts the dollar sign way out front (ugly). I want it to look like: > > Total:$

printf with currency symbols

2009-10-26 Thread Bryan R Harris
Is there a good way to do printf's with currency symbols? I've tried this: printf "Total: \$%10.2f\n", $total; But it puts the dollar sign way out front (ugly). I want it to look like: Total:$24.15 Is there a way to do this without getting all messy like this? printf "Total:%10s\