in reply to insert html tags
i get error message when i execute.
Which one? There are lots of error messages out there, should we guess which one you get?
Anyway, manipulating HTML document is usually best done with some tools that make it easier. For example with a DOM representation:
#!/usr/bin/perl use strict; use warnings; use 5.010; use Mojo::DOM; my $dom = Mojo::DOM->new(do { local $/; <DATA> }); $dom->find('ul')->each(sub { $_->append_content('<span class="backTotop"> <a href="#a4">Bac +k to top</a></span>'); }); say $dom->to_xml; __DATA__ <ul> <li class="orangeTxt1"><a name="a3" id="a3">question-1</a></li> <li>Answer1</li> </ul> <ul> <li class="orangeTxt1"><a name="a4" id="a4">question-2</a></li> <li>Answer2</li> </ul>
|
|---|