Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Generating a list of lists (for HTML::Element) from trivial markup

by alexm (Chaplain)
on Jul 27, 2008 at 23:25 UTC ( [id://700433]=note: print w/replies, xml ) Need Help??


in reply to Generating a list of lists (for HTML::Element) from trivial markup

You're always pushing new elements on the same array in different positions, not different depths:

push @{$list[$depth]}, @current_list;

For instance, in order to h2 being a child of greybox you should:

push @{$list[0][3]}, @current_list;

Where depth means there's 2 array references involved. That's why the recursive solution provied by jethro works better: recursion and depth are intimate concepts.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://700433]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2026-01-15 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.