As just a note - try to get into the habit of indenting. It will help a lot to make your code easier to read (and to find mis-nested blocks when you get further along).
Perl::Tidy can help clean up your code automatically.
Comment on Re: Perl Script to count files and directories is not working.