my $i=1; for my $href(@href) {my $url4= "http://www.ebi.ac.uk$href[$i]; $content=get($url4); $i=$i+1; } } #### 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; .. Build HTML tree etc ... }