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); # judge result and next action based on $response_code open(F ,">/home/philip/Desktop/reg-out.txt"); print F "$response_body\n\n"; close(F); my @urls=$response_body =~ m{(http://b.thumbs.redditmedia.com/(?!png)(?strerror($retcode)." ".$curl->errbuf."\n"); }