#!/usr/bin/perl # Include the WWW::Mechanize module use WWW::Mechanize; #use LWP::Simple; <--Notice this is a comment now # What URL shall we retrieve? $url = "http://www.rediff.com/rss/inrss.xml"; # Create a new instance of WWW::Mechanize my $mechanize = WWW::Mechanize->new(autocheck => 1); # Retrieve the page $mechanize->get($url); my $title =$mechanize->title; print "$title"; # Place all of the titles in an array my @title = $mechanize->title; open(FH, ">rediff.txt"); # Loop through and output each title foreach my $title (@title) { # Retrieve the link URL # my $href = $link->url; print FH $title; print FH "\n"; } close(FH);