Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

padding/substr quirk

by RolandGunslinger (Curate)
on Jan 10, 2004 at 21:30 UTC ( #320383=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!perl
    use strict;use warnings;
    ...
    print "substr day= " . (substr("0" . localtime->mday(), -2)) . "\n";
    print "sprintf month= " . (sprintf "%02d", localtime->mon() + 1) . "\n
    +";
    print "sprintf day= " . (sprintf "%02d", localtime->mday()) . "\n";
    
  2. or download this
    >perl pad.pl
    substr month= 1
    substr day= 09
    sprintf month= 01
    sprintf day= 09
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://320383]
Approved by Roger
help
Chatterbox?
[Corion]: marioroy: So you live dangerously ...
[Lady_Aleena]: s/latter/ladder/; # ? marioroy
[karlgoethebier]: marioroy: Praise the Lord
[marioroy]: Well, that's why there must be angels around, invisible or not.
[marioroy]: Lady_Aleena yes, ladder.
[marioroy]: Corion, no not intentionally. not at all.
[Lady_Aleena]: /ne tries to decide whther or not to take a hammer to hubby's alarm clock.
[Lady_Aleena]: He never hears it.
[marioroy]: Back in HighSchool, I came late to Gym class. There was a fellow who was picked last, no team wanted him for racketball. So it was us two against everybody. I looked at him in the eye and said to let your body loose and let the powers to be help us win.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-05-29 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?