For what it's worth, here's how I'd probably have written it (something like this anyhow). I'm not too sure about the glob. I've heard about how it's better to use the opendir/readdir combo, so I'm not too sure what to think of that.
#!perl -w use strict; chdir('bar') or die("chdir() failed: $!\n"); my $cnt; rename( $_, sprintf('%03d-%s', ++$cnt, $_) ) or warn("rename() failed: $!\n") for ( grep { ! /\A\./ } glob('*') );
In reply to Re: Rename FILE to nnn-FILE
by saskaqueer
in thread Rename FILE to nnn-FILE
by uksza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |