First, please forgive my absence. It's been almost 2 years since my last confession, er... post. As a result of this and not playing with perl in the mean time, I've forgotten a bit.
The question: I have this cgi script:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
&print_return_page_top;
if (open (FILENAME, "..//..//test//index.html"))
{
$line = <FILENAME>;
while ($line ne "")
{
print "$line";
$line = <FILENAME>;
}
}
else {
print "Booger<br>";
}
&print_return_page_bottom;
##################################
sub print_return_page_top
{
print <<RETURN_PAGE_TOP;
<HTML>
<HEAD>
<TITLE>Update Index</TITLE>
</HEAD>
<BODY>
Type your changes in the box below and then press Submit:
<BR>
<FORM NAME="update-index" ACTION="update-index.cgi" METHOD="get">
<TEXTAREA ROWS="20" COLS="100" NAME="index-data">
RETURN_PAGE_TOP
}
###################################
##################################
sub print_return_page_bottom
{
print <<RETURN_PAGE_BOTTOM;
</TEXTAREA>
<BR>
<INPUT TYPE="Submit" NAME="Submit" VALUE="Submit">
</FORM>
</BODY>
</HTML>
RETURN_PAGE_BOTTOM
}
###################################
Works just as I want it, meaning it takes the html file I'm looking at and dumps it into the textarea. However, I want to grab just a portion of the file I'm reading from. I have
<!-- Begin --> and <!-- End --> comments in the file and want to grab the stuff between them. I tried playing around a bit with the above script and these comment lines, but all I got was a blank textarea.
Can someone help me out?
Thanks!
_____________________________________________________mojobozo
word (wûrd)
interj. Slang. Used to express approval or an affirmative response to
something. Sometimes used with up. Source
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.