Click here to get back home

Can't find right printf format

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Can't find right printf format Hubert Gabler 04-28-2008
Posted by Hubert Gabler on April 28, 2008, 1:45 pm
Please log in for more thread options
Hello,
my problem is very simple, but I cannot find the answer in "Learning
Perl" nor in the manpages:
Which FORMAT in printf makes the numbers 1,2,3,.. look like 001,002,003..?
Hubert

Posted by Steven M. O'Neill on April 28, 2008, 2:01 pm
Please log in for more thread options
>Hello,
>my problem is very simple, but I cannot find the answer in "Learning
>Perl" nor in the manpages:
>Which FORMAT in printf makes the numbers 1,2,3,.. look like 001,002,003..?
>Hubert

The magic word is "padding".

http://www.google.com/search?q=printf+padding

--
Steven O'Neill steveo@panix.com
Brooklyn, NY http://www.panix.com/~steveo

Posted by Gunnar Hjalmarsson on April 28, 2008, 2:06 pm
Please log in for more thread options
Hubert Gabler wrote:
> Which FORMAT in printf makes the numbers 1,2,3,.. look like 001,002,003..?

The FORMAT options for printf() are described in

perldoc -f sprintf

(as mentioned in "perldoc -f printf")

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Uri Guttman on April 28, 2008, 4:59 pm
Please log in for more thread options

HG> my problem is very simple, but I cannot find the answer in
HG> "Learning Perl" nor in the manpages: Which FORMAT in printf makes
HG> the numbers 1,2,3,.. look like 001,002,003..? Hubert

FAQ

perldoc -q pad

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------

Posted by Hubert Gabler on April 29, 2008, 2:16 am
Please log in for more thread options
>...you need to look in perldoc -f sprintf.

Thanks to all who gave me this hint. I simply overlooked the link from
printf to sprintf. I promise to read the manpages more careful in the
future before asking the experts!
Kind regards,
Hubert

Similar ThreadsPosted
Re: printf doesn't do right justify March 9, 2008, 8:32 am
printf doesn't do right justify March 9, 2008, 8:04 am
printf and variable length? October 25, 2005, 10:03 am
Using printf to modify scalars May 19, 2006, 8:44 am
printf: zero pad after the decimal a given amount March 30, 2008, 4:09 pm
printf + escape code May 22, 2008, 12:36 am
perl win32 & output of printf November 5, 2004, 4:15 pm
To store the output of printf into a variable... April 3, 2005, 9:56 am
converting exponential format number to decimal format number December 14, 2006, 5:32 pm
Passing paramaters to the File::Find find() function February 15, 2006, 5:39 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap