CUFP
idnopheq
snippet
<div class="Description">This two minute, the chanting REALLY works, kind of script allows me to grab DB log files from a web server. 1, 01, 001, and 0001 are different and incremented. Let me know if I could improve this (I did start it as a one liner, though, so no error checking, etc.). Shows how to increment yet pad leading zeros as necessary.
<p><b>
Update
</b>
: Modified this based on <a href=http://www.perlmonks.org/index.pl?node_id=20087&lastnode_id=69912>extremely</a>'s advice.
<p>
<code>
$Start = substr(++($Start="z$Start"),1);
</code><p>
This is the key.</div>
<CODE>
#!/usr/bin/perl -w
#-*-perl-*-
use strict;
use LWP::Simple;
my $Pre = $ARGV[0]; # the URL up to num FIXED
my $Post = $ARGV[1]; # the URL after num FIXED
my $Start = $ARGV[2]; # starting num INC
my $Max = $ARGV[3]; # ending num (by request)
until ( $Start > $Max ) { # starting num until ending num
my $Url = "$Pre$Start$Post";
getstore (
$Url,
"$Start$Post"
);
# below is where the magic happens
$Start = substr(++($Start="z$Start"),1);
}
</CODE>