* Bernie Cosell <[EMAIL PROTECTED]> [2004-04-19 17:37]:
> So: what I want is something to format money correctly, whther
> it is fractional or not. there's the fairly awful:
>
> sprintf ($amt =~ /\.\d\d\d/? "%7.3f": "%7.2f"), $amt
>
> Not much better and a ton more dangerous [due to rounding]:
> sprintf (int($amt/100) == $amt/100 ? ...etc
I am stupid and slow. Of course it can be done with math, and
easily too:
sprintf ( ( $amt * 1000 ) % 10 ? "%7.3f" : "%7.2f " ), $amt
--
Regards,
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."