Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Optimize file renaming.

by Tomtom (Scribe)
on May 26, 2005 at 08:00 UTC ( [id://460629]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 08:32 UTC
    $ echo '1.png' | perl -lpe '$_=sprintf "%07d", $_' 0000001

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://460629]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.