in reply to Removing long pathes on windows xp

One initial comment... you should local-ize the DIR filehandle like this:
sub recursive_remove { my($dir) = @_; local(*DIR); opendir(DIR, $dir) || die "Error: $dir $!\n"; ...
otherwise you are reusing the same file handle as you recursively call yourself. Don't know yet if this is causing your problem or not.

Replies are listed 'Best First'.
Re^2: Removing long pathes on windows xp
by Anonymous Monk on Dec 19, 2007 at 17:43 UTC
    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