in reply to How to find most recent file and use it?
It might also be useful to consider tools like File::Find::Rule and its brethren, to provide a more platform-independent and/or perhaps easier to modify approach to the task. Sometimes you find code that contains “a set of chicken-scratches that works,” and your task is to modify it. :-O!! It therefore might be worth considering an approach that, from the outset, delegates the file-searching and/or selection process to an existing body of CPAN code with an eye toward long-term serviceability and maintainability.