in reply to Some problems with my code - Help...

Hi,

Question 1: You cannot write to a file with the name of an existing directory. Possibly helpful could be an extention ".txt" to that file

$dir=$entry . ".txt";
Question 2: File::Find's subroutine is called for any single item while traversing the directory-tree. If you change the $file in the second if-block to $entry your code will run proper. But i think the result of scattered $dir.".txt"-files in the whole tree which are often empty will be not what you wanted.

A good explanation how File::Find works could be found in spurperl's Beginners guide to File::Find