Said this, I would use glob, rather than opendir & friends. In any case your code doesn't seem too bad, for you take care of specifying the full path to your files.use strict; use warnings;
$dir =~ m|/$|; # Do you get the point?!?
Update: I'm an idiot - it had been chopped, and now I see why you did do it in the first place. Still, it makes for clumsy logic and code, IMHO. PS: $dir does not need to be chopped, and if it did, then it would have been better chomped instead. Also, consider using a more effective indenting style.
Update: ditto as the (update) above!
PS2: now that I look at your script more closely, I feel like pointing out too that since it's not Perl6 yet (thus we do not have zip), your logic is somewhat awkward: why not doing it all in one iteration rather than in two?!? That is what most people would do even if we already had better means to iterate over two arrays in parallel - but maybe even then an AoA would be preferable. TMTOWTDI, you know...
In reply to Re: Rename All Files In a Directory
by blazar
in thread Rename All Files In a Directory
by dReKurCe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |