use strict; use warnings; use WWW::Curl::Easy; my $curl = WWW::Curl::Easy->new; $curl->setopt(CURLOPT_HEADER,1); $curl->setopt(CURLOPT_URL, 'http://www.reddit.com/r/wallpapers.rss'); my $response_body; $curl->setopt(CURLOPT_WRITEDATA,\$response_body); # Starts the actual request my $retcode = $curl->perform; # Looking at the results... if ($retcode == 0){ print("Transfer went ok\n\n"); my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); my @urls=$response_body =~ m{(http://b.thumbs.redditmedia\.com/(?:(?!png).)*?\.jpg)}gi; $" ="\n\n"; print "@urls\n"; } else { # Error code, type of error, error message print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n"); }