#!/usr/local/bin/perl use strict; use warnings; use LWP::Simple; use HTML::TreeBuilder; my $url="http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=1r9t&template=main.html"; my $content=get ($url); my $chain; my @chains; my $p = HTML::TreeBuilder->new; $p->parse_content($content); my @tds = $p->look_down(_tag => q{td}); for my $td (@tds) { my $a = $td->look_down(_tag => q{a}); next unless $a; if ($a) { my $href = $a->attr(q{href}); if ($href =~ /&chain=(\w)"/) { print $1 qq{\n}; $chain=$1; push @chains, $chain; #I want to extract the chains....A,B,C,D,E,F,H,I,J,K,L } } $p->delete; }