Is it a fullpath problem?
my $path = "/path";
opendir( DIR, $path );
my @dots = grep(/recovery/, sort { -M "$path/$a" <=> -M "$path/$b" }
readdir(DIR));
closedir(DIR);
Note that the perlfunc documentation for readdir says:
If you're planning to filetest the return values out of a readdir, you'd
better prepend the directory in question. Otherwise, because we didn't
chdir there, it would have been testing the wrong file.
----- Original Message -----
From: "LUKE" <[EMAIL PROTECTED]>
To: <modperl@perl.apache.org>
Sent: Friday, January 13, 2006 1:06 AM
Subject: Re: -M in modperl
The result is not sort by file's mtime!
But if i run the code in cgi or shell. It is sort by file's mtime.
----- Original Message -----
From: "LUKE" <[EMAIL PROTECTED]>
To: <modperl@perl.apache.org>
Sent: Friday, January 13, 2006 12:58 AM
Subject: -M in modperl
opendir( DIR, "/path" );
my @dots = grep(/recovery/,sort { -M $a <=> -M $b } readdir(DIR));
closedir(DIR);
Can not work in mod_perl?? How to solve it??