in reply to trying to rename files

You don't get the full path of the file from readdir - you need to append the path to the filename before you do the rename.

I'm also not sure what you think you are doing with the $_ - if you supplied use warnings you would be told about the problem.

/J\