use warnings; use strict; use LWP::Simple; my ($html, $url); my $count = 0; $html = get("http://localhost:8080/html.htm"); die "Couldn't fetch page." unless defined $html; if ($html =~ m{<(a class=\"smallV110\" href=\"/)(.*?)\">} ) { $url = $2; print "$url\n"; $count++; print "$count\n"; } else { die "couldn't match"; }