You might want to look at HTML::TreeBuilder and HTML::Element which have a method $elt->address() which already does this.
In reply to Re: tracking where I am in a tree structure
by Fletch
in thread tracking where I am in a tree structure
by agaffney
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |