in reply to parsing html

It is not entirely clear what you want to do, but if you need to extract the values of the first cell in TRs which class name starts with 'violet', then you could use HTML::TreeBuilder::XPath:

#!/usr/bin/perl use strict; use warnings; use HTML::TreeBuilder::XPath; my $tree = HTML::TreeBuilder::XPath->new; # empty tree $tree->parse_file( 'myfile.html'); my @values= $tree->findvalues( '//tr[@class=~/^violet[0-9]/]/td[1]'); foreach my $value (@values) { print $value, "\n"; }