http://qs1969.pair.com?node_id=11138538


in reply to How do we remove specific HTML element

a certain html element located by its nth order from the top/start of file

The CSS :nth-of-type() selector might be what you are looking for, which is supported by Mojo::DOM::CSS; try changing the 1 to a 2 in the following to see the effect:

use Mojo::DOM; my $dom = Mojo::DOM->new($html); $dom->at('nav:nth-of-type(1)')->remove; print $dom->to_string;