25 Nov 2010

How to extract Headlines from Perlmonks

Do you want to visit perlmonks site only when you see an interesting posting? Here is a simple script which gets the headlines from perlmonks and gives corresponding link.
If you are interested then just go to the link. This takes .01 sec to get the headlines from perlmonk site.

use XML::Simple;
use LWP::Simple;
my $xml = get("http://www.perlmonks.org/headlines.rdf");
my $xs = XML::Simple->new();
my $ref = $xs->XMLin($xml);
my @items = @{$ref->{item}};
print "Perl Monks Head Lines \n\n";
foreach $item (@items) {
print "$item->{link} - $item->{title}\n";

No comments:

Post a Comment