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)

In reply to (jeffa) Re: Downloading a range of sequential files by jeffa
in thread Downloading a range of sequential files by Ionizor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.