You might try something like that:
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $start =
"http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl
+?pdbcode=2j6p&template=ligands.html&l=1.1";
my $m = WWW::Mechanize->new( autocheck => 1 );
$m->get($start);
my @links = $m->find_all_links();
print "No link\n" unless @links;
for my $link (@links) {
next unless $link->text;
if ( $link->text =~ /EPE/msx ) {
print $link->text, "\n";
}
}
# Output:
# EPE 1148(C)
# EPE 1148(D)
# EPE-EPE
hth,
PooLpi