Just some quick ideas::
- You don't have warnings enabled
- Implement this in File::Find with a recursion counter
From what I can tell, you are probably running out of filehandles as you are recursing on a dir but not closing the handle above. You might want to consider closing the handle before the recursion call and then reopening it.
An untested idea:
foreach my $file (sort(readdir(PARSEDIR))) {
.....
becomes:
my @list = sort(readdir(PARSEDIR));
closedir(PARSEDIR);
foreach (@list)
{
.....
That way the handle is closed immediately.
Unfortunately I can't run your code on my puter as I don't have any of your support modules. So I can't be of more help.
Simon