http://www.perl.com/pub/doc/manual/html/pod/perlfunc/sprintf.htmlhttp://www.perl.com/pub/doc/manual/html/pod/perlfunc/printf.html
adam
> -----Original Message-----
> From: ilug-admin at linux.ie [mailto:ilug-admin at linux.ie]On Behalf Of
> Cormac McClean
> Sent: 19 May 2000 12:42
> To: ilug at linux.ie> Subject: [ILUG] OT: Formatting Perl output on Web Page?
>>> Hi,
>> This is probably a RTFM question, and I am checking, but no joy.
> I also have 2 books on Perl but I loaned these and am (temporarily)
> bereft of their wisdom. (Question is possibly also OT).
>> I am using Perl and Apache on Linux to read data from text files and
> output the data into a HTML table. (Next step will be to use MySQL
> to store the data). My question is this: how do I curtail the amount
> of decimals being displayed from a decimal scalar, e.g. to get the
> percentage attendance based on classess attened / total classes * 100:
> $att_pc = $att / $total * 100;
> when I display this using a print statement I get 12 decimal places,
> which looks a bit silly:
> print "<TD align=center>$att_pc</TD>";
>> Is there a Perl equivalent to the C %.2f to format output to 2 decimal
> places?
>> Apologies for the OT nature of this question.
>> Regards,
> Cormac.
>> --
> Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!