in reply to Re: Removing long pathes on windows xp
in thread Removing long pathes on windows xp

or better yet, lexical-ize the filehandle:

sub recursive_remove { my ($dirname) = @_; opendir my $dirhandle, $dirname or die "opening $dirname: $!"; foreach my $file (readdir $dirhandle) { ... } }

i don't think the non-local or non-lexical nature of the directory handle is causing the problem because the names of the files in the directory are immediately read and the directory handle is never referred to again.
the problem is more likely due to the length limit mentioned below.

btw: the regex  /^\.{1,2}/ fails for files with names like  .initrc
try using an end-anchor assertion:  m{ \A \.{1,2} \z }xms