#!/usr/bin/perl use strict; use warnings; use HTML::TokeParser::Simple; my $html = q{

A

Abbott, Evelyn
110136892
Agnew, Thomas
110377660
Allison, David
108116112
Allison, Gary Owen
116815754
Arsenault, Michael
108318866
Arsenault, Normand A.
113069066
}; my $p = HTML::TokeParser::Simple->new(\$html); # parse until second table my $table_count = 2; while (my $t = $p->get_tag('table')){ last unless --$table_count; } my (%href, $this_href, $number); while (my $t = $p->get_token){ if ($t->is_start_tag('a')){ $this_href = $t->get_attr('href'); next; } if ($t->is_start_tag('span')){ $number = $p->get_trimmed_text('/span'); $href{$this_href} = $number; next; } last if $t->is_end_tag('table'); } for my $key (keys %href){ print "$key -> $href{$key}\n"; }