#!/usr/local/bin/perl -w use XML::Smart; # Set base URL for all eutils my $utils = "http://www.ncbi.nlm.nih.gov/entrez/eutils"; # Setting up to search Pubmed for the term Cancer+Prostate # getting back a maximum of 10 records my $db ="Pubmed"; my $query ="Cancer+Prostate"; my $retmax = 10; #Build the URL to use esearch.fcgi my $esearch = "$utils/esearch.fcgi?" . "db=$db&retmax=$retmax&term="; # This module also uses LWP to post URL and get the # resulting XML page. Which is stored in $results my $results = XML::Smart->new($esearch.$query); # printing the variable and URL that was used my $count = $results->{eSearchResult}{Count}; my @Id = $results->{eSearchResult}{IdList}{Id}('@'); my $all_Id = join("\n",@Id); print "Count = $count\n"; print "$all_Id\n";