If you are using perl, you could use printf instead of print, and fixing the format for $total accordingly.
Steve Nisbet
Web Admin DoCM
"Cox, Will" wrote:
> I have a cgi script which reads the answers you give to a quiz on a page (each answer has a numeric value) adds them together and comes up
> with a percentage result - $total.
>
> It then prints the value of $total on a results page. The problem is it produces the answer to 13 decimal places!
>
> Does anyone know of a way to get $total to become a straight percentage (ie 33% not 33.3333333333333%)?
>
> Will
>
> --------------------------------------------------------------------------------
> Will DG Cox - New Media Marketing Officer
> Marketing and Development, Sheffield Hallam University
> Tel 0114 225 3893 Fax 0114 225 2094 E-mail [log in to unmask]
|