Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: percentage and sprintf

by ambrus (Abbot)
on May 15, 2013 at 09:44 UTC ( #1033650=note: print w/ replies, xml ) Need Help??


in reply to Re: percentage and sprintf
in thread percentage and sprintf

That works, but I'd recommend this instead so that the percentage is rounded to an integer rather than truncated.

my $bar = sprintf "%2.0f%%", $foo * 100;


Comment on Re^2: percentage and sprintf
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (16)
As of 2015-07-28 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls