Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: round up digits in numbers

by quester (Vicar)
on Dec 05, 2008 at 07:35 UTC ( #728209=note: print w/ replies, xml ) Need Help??


in reply to round up digits in numbers

You want the printf function.

For example:

#! /usr/bin/perl -w use strict; use diagnostics; my $n=42; printf "%05d\n", $n;
See sprintf for details of the first argument to printf.


Comment on Re: round up digits in numbers
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://728209]
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: (10)
As of 2015-07-08 02:08 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 (93 votes), past polls