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: Regular Expressions:
Justification in Perl

 



C_PRASANNA
Novice

Feb 21, 2013, 4:34 AM

Post #1 of 3 (11028 views)
Justification in Perl Can't Post

Hi Guys,

How to justify the below,

Input = 1.2

Output = 001.2


I need the above output in the Perl AS simple AS possible.

By,

Prasanna - India


FishMonger
Veteran / Moderator

Feb 21, 2013, 6:31 AM

Post #2 of 3 (11025 views)
Re: [C_PRASANNA] Justification in Perl [In reply to] Can't Post

perldoc -f sprintf
http://perldoc.perl.org/functions/sprintf.html

Or, even more simple - use concatination


(This post was edited by FishMonger on Feb 21, 2013, 6:32 AM)


paxxus
New User

Feb 26, 2013, 5:00 PM

Post #3 of 3 (10989 views)
Re: [C_PRASANNA] Justification in Perl [In reply to] Can't Post

printf( "%05.1f\n", $input );

 
 


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

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