I don't think you want the
@filez=<DIR> line. For one, you don't even seem to be using that array. Also, the angle bracket operator is looking for the filehandle at DIR, and not a dirhandle. If you want the list of files, use
readdir like you have in the
foreach loop.
I don't know if this is the source of your error, but you may want to get rid of it anyway. BTW, knowing which line is line 10 would help a lot!
blokhead