use LWP; use HTTP::Request::Common; # # .... # sub fetch_headlines { my @D; my $ua = new LWP::UserAgent; return 0 unless ($ua); $ua->proxy('http', 'http://myproxy.mynet.org:8080'); #set up your proxy here my $url = "http://www.slashdot.org/slashdot.xml"; my $res = $ua->request(GET $url); if ($res->is_success) { @D = split /\n/, $res->content; } else { return 0; } my ($title, $url); for (@D) { $title = $1 if /\(.*)\<\/title\>/; $url = $1 if /\(.*)\<\/url\>/; if (/<\/story>/) { $stories{$url} = $title; push(@keys, $url); $title = ""; $url = ""; } } return 1; }