opendir DIR, $directory or die $!; my @files = sort{-M $a <=> -M $b}grep{$_ !~ /^\.?\.$/}readdir(DIR); closedir DIR;