#!/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 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