Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Syntactic Confectionery Delight
 
PerlMonks  

Re: Private Utilities

by Anonymous Monk
on Dec 01, 2005 at 07:02 UTC ( [id://513244]=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 Private Utilities

i use this (way to often) to renumber image files so they'll sort in order.
#!/usr/bin/perl # # renum.pl blah*.jpg # blah1.jpg .. blah9.jpg blah10.jpg .. blah99.jpg blah100.jpg # -> blah001.jpg .. blah010.jpg .. blah100.jpg foreach ( @ARGV ) { next unless ($stem, $digits, $ext) = /(.*?)(\d+)\.([^\.]+)$/; $max = $len if ($len = length( $digits )) > $max; print "$_ $1\n"; } $fmt = "$stem\%0${max}d.$ext"; foreach ( @ARGV ) { next unless ($stem, $digits, $ext) = /(.*?)(\d+)\.([^\.]+)$/; $new = sprintf $fmt, $digits; rename $_, $new or warn $!; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://513244]
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.