David,

Verily, on Wednesday June 13, 2001, the Sainted David Kenneally spake:
> #!/usr/bin/perl -w
> 
> 
> opendir DIRH, "/home/dwk/test" or die "can't open it: $!\n";
> @allfiles = readdir DIRH;
> closedir DIRH;
> foreach $temp (@allfiles) {
>   if (-M $temp < "0.5") {
>    print "$temp\n";
>    } else {
>    print "$temp is older than 12 hours\n";
>      }
>   }

Looks to me as the though the problem is with your comparison.
Enclosing "0.5" in quotes forces Perl to treat the 0.5 as a
string rather than a number.  This is called "stringification"
and is an easy mistake to make.

I should stress that I'm not certain this is causing your
problem.  However, I *am* certain that doing this is not
the best practice, and I highly recommend that you quote
things only when absolutely necessary.

Short answer: remove the quotes from "0.5" and try it
again. :)

HTH,

John
-- 
               John Fox <[EMAIL PROTECTED]>
    System Administrator, InfoStructure, Ashland OR USA
  ---------------------------------------------------------
"What is loved endures.  And Babylon 5 ... Babylon 5 endures."
              --Delenn, "Rising Stars", Babylon 5

Reply via email to