@URLs = ("http://www.snap.com/search/directory/results/1,61,-0,00.html?&keyword=%s", "http://www.snap.com/search/directory/results/1,61,-0,00.html?&keyword=%s&start=20", "http://www.snap.com/search/directory/results/1,61,-0,00.html?&keyword=%s&start=40", "http://www.snap.com/search/directory/results/1,61,-0,00.html?&keyword=%s&start=60", "http://www.snap.com/search/directory/results/1,61,-0,00.html?&keyword=%s&start=80"); sub getpage { my($page, $search) = @_; $page--; return $SearchStat::E_RANGE if($page<0 || $page>$#URLs); $url = sprintf($URLs[$page], $search); $page = &fetch($url); return $SearchStat::E_NOTFOUND if $page == $SearchStat::E_NOTFOUND; @urls = (); return E_RANGE if $page =~ m!Sorry, no matches were found containing .*!is; while($page =~ m!!is) { my $url = $1; $url = unurlize($url); $page =~ s!!!is; @urls=(@urls, $url); } return \@urls; } $valid = 1; 1;