in reply to Re^4: Resseting perl -M file mod after xx minutes
in thread Resseting perl -M file mod after xx minutes

If the goal is to process any files that are older than a given value, even if there is just one file, then the script doesn't work as it should.

  • Comment on Re^5: Resseting perl -M file mod after xx minutes

Replies are listed 'Best First'.
Re^6: Resseting perl -M file mod after xx minutes
by ikegami (Patriarch) on Jul 13, 2009 at 18:18 UTC
    You presume that "as it should" means there isn't a minimum number of files required. I don't see any indication your assumption is true — in fact, it seems to contradict the printed message — but if it is,
    if (scalar(@Files) > 1) {
    or
    if (@Files > 1) {
    should be replaced with
    if (scalar(@Files) > 0) {
    or
    if (@Files > 0) {
    or
    if (@Files) {

      The reason that I raised the question in the first place, is that skipping the directory scan just because there is just one file seems like a very strange thing to do. Even if its a conscious decision made by learningperl01 (note the handle), I still believe its appropriate to raise the question, since it looks like a classical off by one error.

      The printed error message could just be a sloppy way of writing there are no files to process, but we're hardly getting anything out of discussing it further, since learningperl01 isn't following the thread any longer.