in reply to File search

Well, I would use opendir to open a directory handle, and readdir to read the results into a list. Then I'd push the list through some sort of loop, like foreach or while and strip out the numbers from the names (of course you could also use map to process the whole list all at once). Once I had the numbers in a list by themselves, I'd sort the list and pull out the largest either by getting the first or last element of the result. If I had a very large number of files and sort was taking too long, I'd use a loop, probably foreach, and store the largest value I had seen at any point in a variable, so that when I finished the list, I'd have the largest. I'm just lazy and the sort approach would take less typing, even though it is much slower.


TGI says moo