in reply to File list by date

What is the ($files >= 1) bit for? You're putting a string (the filename) into a numeric context here? Are your filenames numeric or are you trying to test to see if $files is non-empty? If it's the latter, consider just doing if ($files) { ... }, but realize that your while statement above that would have done that test itself, or else you wouldn't be inside the loop! The plural itself is kind of a misnomer as well, but it's not hurting anything.

In addition, expanding upon your 'while' test, if you have a filename of 0 (zero), your loop will exit, even if there are more files to be read. Consider checking for defined-ness: while (defined ($file = readdir(DIR))) { ... }