my @urls = ($url);
my @next_set;
while (@urls) {
# Storage for links
my @next_set;
for my $url (@urls) {
# Get the page & such
$mechanize->get($url);
my $page = $mechanize->content;
my $title = $mechanize->title;
print "$title
";
# add the pages links to the next list
push @next_set, $mechanize->links;
}
# OK, we've processed all in @urls, so load @urls
# with all the links we've found since last time,
# and start over again.
@urls = @next_set;
}