Don't ask to ask, just ask | |
PerlMonks |
Re: Is there a way to display numbers with an implied decimal position?by Crulx (Monk) |
on Feb 15, 2000 at 03:54 UTC ( [id://3504]=note: print w/replies, xml ) | Need Help?? |
So you basically want
to return 123456 What happens on 12345.6789 Do you want 12345678 or 12345679 ? Or do you want something else? Assuming the last case is correct... does what you want. You can specify arbitary decimal places by passing in a second arg and replacing sprintf("%.3f",$num); with sprintf("%.$dec_places",$num); Crulx
In Section
Seekers of Perl Wisdom
|
|