Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

padding/substr quirk

by RolandGunslinger (Curate)
on Jan 10, 2004 at 21:30 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://320383]
Approved by Roger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-18 04:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found