Berkeley CSUA MOTD:Entry 28569
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/04/06 [General] UID:1000 Activity:popular
4/6     

2003/5/28 [Computer/SW/Languages/Perl] UID:28569 Activity:nil
5/27    In Perl, how would I print a number with leading zeros if it's less
        than a certain number of digits (eg. I want 3 digits, so '2' = '002')
        I can do it an ugly way (have a bunch of 'if length' statements), but
        I'm wondering if there's a more elegant way.
        \_ printf "03%d",$variable;
           \_ always giving it away....  how will they ever learn?