Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Heeeelp !

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi
I have a little problem(Very big for me)
I want to read in a HTML file into my Perl program.
It starts like
<!--start-->
In my Perl program I can write to this html.
After some writings it will look like this
<!--start-->
<p>aaaaaaaaaa</p>
<p>bbbbbbbbbb</p>
<p>cccccccccc</p>
and so on forever ....almost.
My tricky question is how a can build a small Web(HTML) interface
to remove some or all lines in this HTML file(All lines but not <!--start-->.
I would like that those lines was brought upp in the webbrowser with small buttons on
its side like delete buttons
--------
-Delete-aaaaaaaaaa
--------
--------
-Delete-bbbbbbbbbb
--------
And then if i press The first Delete button the aaaaaaaaa lines will be removed.
Can someone please help me with this or hand over
some great link about this problem.
 
First you have to open your file and read the contents:

open(HTML,&quot;yourfile.html&quot;) || die &quot;$!&quot;;
@HTML = <HTML>;
close (HTML);
$html = join(&quot;\n&quot;,@HTML);

Then you have to parse your HTML using regular expressions like this:

$html =~ /<!--start-->((.|\n)*)<!--stop-->/;
$html = $1;

Then $html will contain the contents of your HTML file between the start and stop comments.

BTW, in the future please use a better title for your question than &quot;help&quot;.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top