Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Optimize file renaming.

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


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://460629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2025-05-20 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.