CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Formatting Number

 



liox0001
Deleted

Nov 16, 2000, 7:14 AM

Post #1 of 3 (155 views)
Formatting Number Can't Post

I remember reading it somewhere in the forum before, but I can't find that topic again... can somebody please tell how to format

3 -> 0003
13 -> 0013
998 -> 0998

I recalled the person did it in one line...

thank!


Mendy
Deleted

Nov 15, 2000, 10:33 PM

Post #2 of 3 (155 views)
Re: Formatting Number [In reply to] Can't Post

look at 'perldoc -q pad'
for a few solutions


wardk
Deleted

Nov 20, 2000, 1:23 PM

Post #3 of 3 (155 views)
Re: Formatting Number [In reply to] Can't Post

#!/bin/perl
my $num = 3;
my $fnum = sprintf("%04d", $num);
print $num." => ".$fnum, "\n";

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives