#!/usr/bin/perl -w use strict; use WWW::Mechanize; our $count=1; our $year=1976; while ($year<1977) { my $input; my $agent = WWW::Mechanize->new(); $agent->get("http://europa.eu.int/prelex/rech_avancee.cfm?CL=en"); $agent->form(2); $agent->field("clef2", "$year"); $agent->field("clef1", 'COM'); $agent->field("nbr_element", '99'); $agent->click(); $input=$agent->content(); my @pcplinks = grep { $_->url =~ m!liste_resultats.cfm! } $agent->links; print @pcplinks; my $filecount; $filecount=0; foreach my $pcplink (@pcplinks) { my $input2; print "Retrieving $pcplink\n"; $agent->follow( $pcplink ); $filecount++; $input2=$agent->content(); $agent->back; } }