我在perl / cgi脚本中有以下代码:
$commonContent = <<HTML;
<font color="#CC0000"><strong>$errStr</strong></font>
<h2 class="first">Request ID: $recId<br />(Requested by: $userInfo->[1], $userInfo->[3], $userInfo->[5])</h2>
<h3 style="margin-bottom:16px">Website: $website</h3>
<p><strong>Request Type: $request</strong></p>
<p>Request Description:<br />$description</p>
<p>Priority/Required Turnaround Time: $priority</p>
<p>Pre-deployment review: $review</p>
<p><strong><i>Estimated completion date for this request: $completionDate</i></strong></p>
HTML
我想将HTML的内容写入目录中的文件,以便将其保存为记录。 有谁知道如何做到这一点?我已经在这个问题上阅读了perl cookbook第二版和pro perl,但它对我来说都很有用。
答案 0 :(得分:1)
答案 1 :(得分:1)
my $myfile = '/path/to/myfile.html';
open(FILE, "> $myfile") || die "Couldn't open $myfile: $!\n";
print FILE $commonContent;
close(FILE);