chdir($startdir) should be outside the loop, shouldn't it?
However, I'd look at a rewrite using File::Find or File::Find::Rule. The latter especially simplifies the task:
use File::Find::Rule; my $start = shift || '.'; for my $oldname ( File::Find::Rule->file->in( $start ) ) { ( my $newname = $oldname ) =~ s/\..*?$//; rename $oldname, "$newname.xml" or die "..."; }
In reply to Re: Perl rename method
by FunkyMonk
in thread Perl rename method
by iman_saleh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |