nowaday, people use perl because
a) they will not learn 'c'
b) perl is very good+performant, simply because it's 'c'.
but, they still dont think performant...
- suppose this directory grows to Xthousend entries
the chomp statemen will be executed Xthousend times.
it does not matter how big the @files is, chomp it ONCE.
- immediately break the loop if FOUND
- read the output of 'readdir' in an array, like you did
with 'path/to/file' AND SORT both, its more code... and
performance.
- if you don't want to sort, let the system do it for you
'system("ls");' gives sorted output.
- using sorted lists (and little more code) you don't need
each time, to restart the list on the top.
- good code needs time, once writted, gives time.
FINALLY, why re-invent the wheel ?????
let the system do the job.
assumed your list is called must_list, create an is_list
entering: ls >is_list
then use: comm -13 must_list is_list
look at the output, see man pages comm, diff, cmp ...

guggach