in reply to Downloading a range of sequential files

I don't have time to explain this right now ... but here is a modification of your code that uses plethora of CPAN modules. Hope this helps. :)
#!/usr/bin/perl use strict; use warnings; use URI; use Pod::Usage; use Getopt::Long; use File::Basename; use vars qw($url $min $max $help); GetOptions( 'url|u=s' => \$url, 'min|m=i' => \$min, 'max|x=i' => \$max, 'help|h|?' => \$help, ); pod2usage(-verbose=>2) if $help; pod2usage(-verbose=>1) unless $url and $max; $min ||= 1; my @suffix = qw(.txt .html .htm .cgi .php); my $uri = URI->new($url); my ($name,$path,$suffix) = fileparse($uri->path,@suffix); my ($numb) = $name =~ /(\d+)$/; $name =~ s/\d+$//; my $precision = $numb ? 0 . length($numb) : ''; printf("%s%${precision}d%s\n", $uri->scheme . '://' . $uri->host . $path . $name, $_, $suffix ) for $min..$max; __END__ =head1 NAME listseq.pl - prints range of sequential URLs based on input URL =head1 SYNOPSIS listseq.pl -url [-min] -max Options: -url -u url to construct from -min -m minimum (default 1) -max -x maximum =head1 DESCRIPTION B<This program> will [ fill in description ] =head1 EXAMPLES ./listseq.pl -url=http://foo.com/bar001.txt -max=360 ./listseq.pl -u=http://foo.com/bar001.txt -min=150 -max=360 =head1 AUTHOR Ionizor =cut

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: Downloading a range of sequential files
by Ionizor (Pilgrim) on Jul 25, 2003 at 21:46 UTC

    Quite helpful indeed. Thank you!

    Getopt::Long; and Pod::Usage; seem like they would be quite useful.

    --
    Grant me the wisdom to shut my mouth when I don't know what I'm talking about.