Bugs should be a bigger concern.
You're treating text as a regex pattern in s/$topdir/$recreate_to/.
s/\Q$topdir/$recreate_to/
You're using an unlocalised global (*DIR) in a recursive function. You're not using it in a way that would cause a problem, but why?!
opendir (local *DIR,$dir) || die "unable top open dir $dir $!"; my @files = grep(/\w+/,readdir(DIR)); closedir (DIR);
Better:
opendir (my $dh,$dir) || die "unable top open dir $dir $!"; my @files = grep(/\w+/,readdir($dh)); closedir ($dh);
Update: s/close/closedir/
In reply to Re: Recursive sub efficiency
by ikegami
in thread Recursive sub efficiency
by skywalker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |