use LWP::Simple; use HTML::TreeBuilder; my @ports=qw( P23141 P61177 P60725 P30542 P21817 P29274 Q07343 P08172 P20309 Q9GZZ6 ); for (my $i=0;$i < scalar(@ports);$i++) { my $url= "http://wwwdev.ebi.ac.uk/interpro/ISearch?query=".$ports[$i]."+"; my $resp = get( $url ); my $tree = HTML::TreeBuilder->new_from_content($resp); my $first=$tree->look_down(_tag => 'div',class => 'prot_fam'); $first=$first->look_down(_tag => 'div',class => 'entry-parent'); $first=$first->look_down(_tag => 'div',class => 'entry-parent'); $first=$first->look_down(_tag => 'a'); open (FH,">>result.txt"); print FH $ports[$i].";"; print FH $first->content_list; print FH "\n"; close(FH); }