http://www.perlmonks.org?node_id=478066

anniyan has asked for the wisdom of the Perl Monks concerning the following question:

I am new to perl. I am doing a validation tool to check the section nesting. If no proper nesting, error should be thrown. Yesterday i posted the same question asked assistance with twig coding. Is it possible to find the proper section nesting without using XML::Twig? If so please assist me.

$q ='<sec id="00005"><no>1.1</no> sfasfasdfadsfsdaf <sec id="00010"><no>1.1.1</no> sahfjsahdfasddfj </sec <sec id="00015"><no>1.1.2</no> sahfjsahdfasddfj <sec id="00020"><no>1.1.2.1</no> sahfjsahdfasddfj </sec> <sec id="00025"><no>1.1.2.2</no> safksajdklfasd </sec> </sec> <sec id="00015"><no>1.1.3</no> sahfjsahdfasddfj </sec> </sec> <sec id="00005"><no>1.2</no> sfasfasdfadsfsdaf ........';

Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)