Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: Yesterday Date

by Anonymous Monk
on Feb 04, 2008 at 20:11 UTC ( [id://666084]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Yesterday Date
in thread Yesterday Date

I guess I would have to add
$d = $d -1; if( ($d->day_of_week == 0) ||( $d->day_of_week == 6)){ $d = $d -1; print $d; }
before!

Replies are listed 'Best First'.
Re^6: Yesterday Date
by ikegami (Patriarch) on Feb 05, 2008 at 00:49 UTC
    Nope. You added two bugs

    If you start on a Monday, that'll give you the Saturday. That's why a loop was used.

    If you start on a day other than Sunday or Monday, it won't print anything. That's why the print was outside the loop.

      OK, good point, now what does this line do?

      print $d, $/;

      can I use the result with just this:

      print "$d";


      Thanks!

        $/ is a fancy (and possibly silly) way of saying "\n"

        By the way, putting quotes around nothing but a variable ("$d") is useless, weird and confusing.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-19 03:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found