#!/usr/local/bin/perl use strict; use warnings; use LWP::Simple; my $url3 = "http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=2j6p&template=ligands.html&l=1.1"; my $content =get ($url3); use HTML::TreeBuilder; my $p = HTML::TreeBuilder->new; $p->parse_content($content); my @href; my $href; my @anchors = $p->look_down(_tag => q{a}); for my $anchor (@anchors) { my $txt = $anchor->as_text; if ($txt=~ /EPE\s/) { print $txt, qq{\n}; $href = $anchor->attr(q{href}); print $href, qq{\n}; chomp ($href); push @href, $href; #now I need to go to the link where there are my EPE ligand and then parse and extract the link of the RunLigplot.pl that is the output of a program LigPlot, written in perl, is a postcript, and I need that file as a script to extract info....I need to repeat these parsing for every link,for every EPE.... } } $p->delete; for my $param ( @href ) { my $content = get ( "http://www.ebi.ac.uk$param" ); process_content ($content); # << This is missing from your code !!! } sub process_content { my $content = shift; $p = HTML::TreeBuilder->new; $p->parse_content($content); my @href0; my @anchors0 = $p->look_down(_tag => q{a}); for my $anchor0 (@anchors0) { my $href0 = $anchor0->attr(q{href}); if ($href0=~ /ligplot\d\d_\d\d'/) { print $href0, qq{\n}; push @href0, $href0; for my $param0 ( @href0 ) { $content = get ( "http://www.ebi.ac.uk$param0" ); my $content = shift; print my $param0; #I need to download files from every link $param0... my @files = (["http://www.ebi.ac.uk$param0", "$pdb.$param0.pl"], ); for my $duplet (@files) { mirror($duplet->[0], $duplet->[1]); } } $p->delete; } } }