in reply to Re^2: issue with sprintf..
in thread issue with sprintf..

so better use sprintf properly, put a leading 0 in the pattern after %.

Your s/ /0/ substitution is - politely said - less optimal. ;-)

DB<117> $val=12143 => 12143 DB<118> sprintf("%011.0f", $val); => "00000012143" DB<119> $val=12143951645 => "12143951645" DB<120> sprintf("%011.0f", $val); => "12143951645"

please read the documentation for more details. =)

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: issue with sprintf..
by sathya83aa (Acolyte) on Jan 09, 2014 at 11:45 UTC

    You mean to say I can remove that substitution s/ /0/ and simply use "sprintf("%011.0f", $val);" right?