Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Will checking last modified date take more time than just overwriting?

by Lady_Aleena (Priest)
on Aug 19, 2013 at 08:32 UTC ( [id://1049993]=note: print w/replies, xml ) Need Help??


in reply to Re: Will checking last modified date take more time than just overwriting?
in thread Will checking last modified date take more time than just overwriting?

This might be a dumb question, but does your same_mod_time return 0 or 1 without the return?

Data details:

  • checkbook.xls changes 2 or 3 times a month
  • Outlook.pst changes daily
  • gaming has 21 files in 5 folders, and I haven't touched it for a while
  • fantasy has 2252 files in 520 folders (this folder is huge!)
  • stylers.xml hasn't changed in like forever
  • hexchat has 82 files in 6 folders

Thanks for stopping by.

Have a cookie and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^3: Will checking last modified date take more time than just overwriting?
by kcott (Archbishop) on Aug 19, 2013 at 09:14 UTC
    "This might be a dumb question, but does your same_mod_time return 0 or 1 without the return?"

    It returns TRUE or FALSE, i.e. whatever (stat($_[0]))[9] == (stat($_[1]))[9] evaluates to. In string context, that would be "1" or ""; in numeric context, that would be 1 or 0.

    Modifying the test code I posted previously to demonstrate this:

    $ > xxx 2> yyy $ perl -Mstrict -Mwarnings -E ' sub same_mod_time { (stat($_[0]))[9] == (stat($_[1]))[9] } say ">>>" . same_mod_time(qw{xxx yyy}) . "<<<"; ' >>>1<<< $ perl -Mstrict -Mwarnings -E ' sub same_mod_time { (stat($_[0]))[9] == (stat($_[1]))[9] } say 0 + same_mod_time(qw{xxx yyy}); ' 1 $ > xxx $ perl -Mstrict -Mwarnings -E ' sub same_mod_time { (stat($_[0]))[9] == (stat($_[1]))[9] } say ">>>" . same_mod_time(qw{xxx yyy}) . "<<<"; ' >>><<< $ perl -Mstrict -Mwarnings -E ' sub same_mod_time { (stat($_[0]))[9] == (stat($_[1]))[9] } say 0 + same_mod_time(qw{xxx yyy}); ' 0

    The presence or absence of the return keyword, in that subroutine, is immaterial. Here's what the doco says:

    "return EXPR
    ...
    Returns from a subroutine, eval, or do FILE with the value given in EXPR.
    ...
    In the absence of an explicit return, a subroutine, eval, or do FILE automatically returns the value of the last expression evaluated. ..."

    -- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-28 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found