December 4th, 1999, 01:46 PM
anyone know how to round unsing perl. I need to truncate my price to the nearest cent. I need to format the output as a dollar price. I know how to add the dollar sign, I need to make it so I always have two decimal places.
December 7th, 1999, 06:13 AM
perldoc -f printf
Try that or something like it.
December 16th, 1999, 06:23 AM
I have a Best way in which u will get acrute result:
I have used some thing like this
Connect to any backend database for Eg ORACLE, use this Statement
"Select round($varname) from dual"
and then fetch the row.
you will get Proper result.
The other way is to use MATH Module
Available with perl check in lib directory.
I think this will help u
December 22nd, 1999, 10:20 PM
got it working.
that did the trick. It added a $ to the front and truncated to the nearest cent.
thanks for your help everyone.
December 28th, 1999, 02:38 PM
depends how accurate you want to be I guess!