in reply to find the last lexical entry in a dir without using @ls=readdir

I don't know if readdir will always return a sorted list, but I wouldn't rely on it. (I imagine that the list is in whatever order the entries are in the structure that holds the directory information which is certainly not sorted).

Also, I don't know if your aversion to your method is because of the sorting or just reading the whole list of files into memory, but if you can live with all of the files in memory, you can use a simple for loop or List::Util's maxstr routine.

  • Comment on Re: find the last lexical entry in a dir without using @ls=readdir
  • Download Code