my $path="D:\\perl";
my $file;
chomp($path);
my $filename;
opendir(DIR, "$path") || die "Cannot open it:$!";
@filename = grep -f, readdir(DIR);
close DIR;
@files = sort{ -M "$path/$b" <=> -M "$path//$a" } @filename; # -M指定按修改日期排序
print "\n";
foreach $file (@files)
{
print $file,"\n";
}