in reply to Optimize file renaming.

I think you could use sprintf like :
$result = sprintf("%07s", $name);
"%07d", since your new file names would always 7 characters long.

Update : too late :(

Update : As blazar said, "%07d" is wrong, I updated it to "%07s", which seems to work better : sorry for the mistake.

Replies are listed 'Best First'.
Re^2: Optimize file renaming.
by blazar (Canon) on May 26, 2005 at 12:32 UTC
    $ echo '1.png' | perl -lpe '$_=sprintf "%07d", $_' 0000001