in reply to Opendir error

As IlyaM points out, you should always check the return codes from functions. opendir will return 1 on success and 0 on failure. I would code it slightly differently:
opendir(DIR, $some_dir) || die "Could not open $some_dir - $!\n"; for my $fileFound(readdir(DIR)) { my $fullPath = $some_dir . "/" . $fileFound; next if (-d $fullPath); # do stuff with each file in $some_dir }
-- vek --