Is this "specific place" in the HTML file between two lines?
If if is, you could do something like this:
open(HTML,"<$html_file") || die "Could not open $html_file:$!\n";
open(TXT,"<$txt_file") || die "Could not open $txt_file:$!\n";
open(OUT,">$output_file) || die "Could not open $ouput_file:$!\n";
while (<HTML>) {
print OUT $_;
if (/this is how you recognise the specific point/) {
while (<TXT>) {
print OUT $_;
}
}
}
If you need to replace something (like a custom tag) in the HTML file with the contents of the TXT file, that's a somewhat different story. If you expect the text file to be short, you could just slurp it into a text variable with
$txt=join("",<TXT>);
and then, at the appropriate point in the loop copying HTML
to the output file, you could to a
s/<custom tag>/$txt/;
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.