Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

How can you format to XXX decimal places without it printing to screen? printf displays the number to the screen, all I want is to chomp off excess of the 2nd decimal place and keep the value in $num. So.. I want to store this information, not print it.

Replies are listed 'Best First'.
Re: printf("%.2f", $num))
by EdwardG (Vicar) on Apr 03, 2004 at 18:59 UTC
      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++, want to be my new best friend? You get all the mello yello and mountain dew you'll ever need free!!! hehe. Thanks for your very quick response, works PERFECTLY!!!!
Re: printf("%.2f", $num))
by TomDLux (Vicar) on Apr 03, 2004 at 20:49 UTC