Pat wrote: > > I have been through man printf, info printf and perldoc -f print and still > can't find how to format numbers. > In the program below I would like to print the numbers as below: > 383.3 as 383.30
$ perl -le'printf "%.2f\n", 383.3' 383.30 > 37492908 as 37 492 908 If we slightly modify the commify() sub from perlfaq5 $ perl -e' sub commify { local $_ = shift; 1 while s/^([-+]?\d+)(\d{3})/$1 $2/; return $_; } print commify( 37492908 ), "\n"' 37 492 908 > 35.7560234069824 as 35.76 $ perl -le'printf "%.2f\n", 35.7560234069824' 35.76 > 1631.11929000261 as 1 631 $ perl -e' sub commify { local $_ = shift; 1 while s/^([-+]?\d+)(\d{3})/$1 $2/; return $_; } print commify( int( 1631.11929000261 ) ), "\n"' 1 631 John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]