Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: HTML::Tree - I can't extract element in the 'correct' order

by choroba (Canon)
on Oct 13, 2012 at 13:13 UTC ( #998848=note: print w/ replies, xml ) Need Help??


in reply to HTML::Tree - I can't extract element in the 'correct' order

Remove print $element->as_text from line 14. It prints the whole text, i.e. concatenation of all text nodes, which means it changes the order. Instead, print each text node when you encounter it in the recursion loop:

foreach my $child ($element->content_list) { if (ref $child) { wiki_render($child); } else { print $child; } }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: HTML::Tree - I can't extract element in the 'correct' order
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2015-07-06 23:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls