#!/usr/bin/perl -w #Tripp Hyde #sucks all the US craigslists prefixex and area IDs for use by the collective craigslist search script BEGIN { my $base_module_dir = (-d '/home2/hhhydeco/perl' ? '/home2/hhhydeco/perl' : ( getpwuid($>) )[7] . '/perl/'); unshift @INC, map { $base_module_dir . $_ } @INC; } use CGI ":standard"; use strict; use LWP::Simple; $| = 1; my ($mainURL, $states, $stateLink, $stateHome, $cities, $cityLink, $cityHome, $areaID); my ($ua, $response, $request); my (@stateLinks, @cityLinks); my $ua = LWP::UserAgent->new; print header; print "
|<\/div>)/s) { @cityLinks = split('\n', $1); foreach $cityLink(@cityLinks) { if($cityLink =~//) { print $1; if(get("http://" . $1 . ".craigslist.org") =~ //) { print " - " . $1 . br(); } } } } } print "";