Home: Perl Programming Help: Regular Expressions:
Justification in Perl



C_PRASANNA
Novice

Feb 21, 2013, 4:34 AM


Views: 17306
Justification in Perl

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


Views: 17303
Re: [C_PRASANNA] Justification in Perl

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


Views: 17267
Re: [C_PRASANNA] Justification in Perl

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