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

Re: padding/substr quirk

by pg (Canon)
on Jan 11, 2004 at 00:19 UTC ( #320398=note: print w/ replies, xml ) Need Help??

in reply to padding/substr quirk

You already got your immediate answer from Corion and Zed_lopez.

Next time, if a similar problem rises, or you need to find out the precedence or associativity of operators, where can you find the answer?


With the help of perlop, next time it is your turn to help others ;-)

Comment on Re: padding/substr quirk
Replies are listed 'Best First'.
Re: Re: padding/substr quirk
by ysth (Canon) on Jan 11, 2004 at 06:52 UTC
    Or feed it to B::Deparse:
    $ perl -MO=Deparse,-p #!perl use strict;use warnings; use Time::localtime; print "substr month= " . (substr("0" . localtime->mon() + 1, -2)) . "\ +n"; 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"; ^D
    which gives:
    use Time::localtime; BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU"} use strict 'refs'; print((('substr month= ' . substr((('0' . localtime()->mon) + 1), (-2) +)) . "\n") ); 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")) +;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://320398]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2015-11-25 20:19 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (690 votes), past polls