opendir(CacheDir,$Cache) || die "Couldn't open the directory $Cache: $!\n"; @filelist=grep { /[0-9]{5}/ } readdir(CacheDir); closedir(CacheDir); @sortlist=sort {$b <=> $a} @filelist; for ($i=0;$i<$MsgCount;$i++) { $filename=$sortlist[$i]; if ($filename) { open(ITEM,"$Cache/$filename");