#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use HTML::LinkExtor; my @linklist; my $url = shift @ARGV; die "You must specify an URL on the command line." unless (defined $url); my $content = get($url); die "URL must by formatted properly. IE http://www.example.com or https://ftp.example.ca" if (!defined $content); my $p = HTML::LinkExtor->new(sub { my($tag, %links) = splice @_; push(@linklist, values %links); }); $p->parse(get($url)); foreach (@linklist){ if ($_=~/.*\.html?$/) { print "$_"; &Section1(); } } sub Section1() { } sub Section2() { } sub Section3() { }