Perl Program to search website and get the data

Hi Experts,

  i want to write a perl program to search a website for some key words, and i want the program to show maximum 10 results, what will be the best method. Any suggestion/ comments will be highly appreciated. Thanks,

Who is Participating?
Kim RyanConnect With a Mentor IT ConsultantCommented:
there is a module, www-search to handle this. It has many front ends to differnent search engines, even the one you want PubMed ( !

use WWW::Search;

$query = "lung cancer treatment";
$search = new WWW::Search('PubMed');
while (my $result = $search->next_result())
    $url = $result->url; $title = $result->title; $desc = $result->description;
    print <a href=$url>$title<br>$desc<p>\n";

sudAuthor Commented:
Hi ,
 i am getting compilation error,
  i think i dont have WWW::Search module how can i get this module. Thanks,

sudAuthor Commented:
  i have installed the module but it does not give me the output???????

any suggestion,

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Kim RyanIT ConsultantCommented:
I would test a sample query manually throught the web interface to see that you have a valid seach criteria
sudAuthor Commented:
I did it with WWW::NCBI::Pubmed, as that is more recent, the WWW::PubMed is old version and does not work properly. Thanks for your response. Thanks,

sudAuthor Commented:
i am fine with B. Thanks,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.