How can I read the files in a directory in sorted order?
问题 When I read a directory in Perl with opendir , readdir , and closedir , the readdir function doesn't seem to read the files in any specific order (that I can tell). I am reading a directory that has subdirectories named by epoch timestamp: 1224161460 1228324260 1229698140 I want to read in these directories in numerical order, which would put the oldest directories first. When I use readdir , the first one it reads is 1228324260, which is the middle one. I know I could put the directory