in reply to Open, Find, Replace, Rewrite, Close.. Advice on best path to take
my $str = q{ <span id=editArea name="whatever"> bla bla a bunch of html and text that will change from file to file </span> }; use HTML::TreeBuilder; my $t = HTML::TreeBuilder->new_from_content($str); foreach ($t->look_down('_tag', 'span')) { next if $_->attr('id') ne 'editArea' || $_->attr('name') ne 'whate +ver'; $_->delete_content; $_->push_content('this is some replacement text'); } print $t->as_HTML; $t->delete;
gav^
|
|---|