User:Squidonius/userpage/code2

use LWP::Simple; my $utils = "http://www.ncbi.nlm.nih.gov/entrez/eutils"; my $db    ="pubmed"; my $query ="1900 [dp]"; my $report ="abstract"; my $esearch = "$utils/esearch.fcgi?db=$db&retmax=1&usehistory=y&term=$query"; my $esearch_result = get($esearch); my $Count   = 0; my $QueryKey = 0; my $WebEnv  = 0; open(OUT,'>year.txt') or die "Can't make file: $!"; for(my $year = 1901; $year < 2010; $year += 1) { $query ="$year [dp]"; $esearch = "$utils/esearch.fcgi?db=$db&retmax=1&usehistory=y&term=$query"; $esearch_result = get($esearch); $esearch_result =~ m|(\d+).*(\d+).*(\S+)|s;

$Count   = $1; $QueryKey = $2; $WebEnv  = $3;

print OUT "$Count articles for $year\n";

}