
sleuth
Enthusiast
Jan 10, 2001, 2:22 PM
Post #4 of 5
(850 views)
|
Ok just checking there. First you must open the file, then separate the top and bottom from each other with those tags. So if your using tags like these: top html <!-- Start --> Content <!-- End --> bottom html Then use this code. open(data, "<file.html"); while(<data>) { $file .= "$_"; } close(data); ($top,$crap)=split(/<!-- Start -->/, $file); ($content,$bottom)=split(/<!-- End -->/, $crap); Now you have to top html in $top and the bottom in $bottom, so now you have to take the input passed to you script and append it to the content between the tags, like so, $content .= qq~ A table with the input passed to your script. ~; Now you can overwrite the html file with the new content. You'll have to put the tags back in because when we used them to split up the file they were taken out. $tag = "<!-- Start -->"; $tag2 = "<!-- End -->"; open(data2, ">file.html"); print data2 "$top$tag$content$tag2$bottom"; close(data2); That's it. Sleuth
|