#! /usr/bin/perl use strict; use warnings; use HTML::Parser; my @links; my $string = qq~<CLIENTS=SITA_FRA_FRA4LHR007 ARINC_FRA_WS1566452 text~; my $p = HTML::Parser->new(); $p->handler(start => \&start_handler,"tagname,attr,self"); $p->parse($string); foreach my $client(@clients){ print $_,"\n" if($_); } sub start_handler{ return if(shift ne 'td'); my ($class) = shift->{href}; my $self = shift; my $text; $self->handler(text => sub{$text = shift;},"dtext"); $self->handler(end => sub{push(@clients,split(/\ /,$text)) if(shift eq 'td')},"tagname"); }