in reply to Re^2: table within table
in thread table within table

Seriously, this is better achieved using one of the HTML::Parser modules. For example take a look at HTML::TokeParser
use strict; use warnings; use HTML::TokeParser; my $p = HTML::TokeParser->new("file.html") # your source file ||die "Cant open: $!"; my $depth=0; while (my $token = $p->get_token) { if (lc(${$token}[1]) eq "table"){ $depth++ if (${$token}[0] eq "S"); $depth-- if (${$token}[0] eq "E"); print "$depth\n"; } }
Try out the code above and see where it takes you

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."