我试图以表格格式对齐两个数组的内容并发送电子邮件。但是表格中的第二列没有按照需要对齐。第二列的内容显示为单行。HTML表格格式问题
我附加输出表,以及:
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;
use HTML::Entities;
my $msg;
my @Sucess = qw(s1 s2 s3 s4 s5 s6);
my @Failed = qw(f1 f2 f3 f4);
my $html = '<table style="width:600px;margin:0 100px" border="1" BORDERCOLOR="#000000">
<thead><th bgcolor="#9fc0fb">Successful</th><th bgcolor="#9fc0fb">Failed</th></thead>
<tbody>';
$html .= "<tr><td>$_</td>" for @Sucess;
$html .= "<td>$_</td>" for @Failed;
$html .= " </tr>";
$msg = MIME::Lite->new(
from => '[email protected]',
To => '[email protected]',
Subject => 'Status of Update',
Type => 'multipart/related'
);
$msg->attach(
Type => 'text/html',
Data => qq{
<body>
<html>$html</html>
</body>
},
);
MIME::Lite->send ('smtp','xyz.global.abc.com');
$msg->send;
soooo ...你不相信结束标签? '':P – SpYk3HH
您可以自由使用任何在Perl中有效的标识符,但熟悉该语言的人以及其他不熟悉英语的人会感谢您使用'snake_case'作为局部变量。首字母大写字母是一个特殊的问题,因为语言本身保留了诸如包名等全局标识符的名称。看起来你不需要在@ @ success和@ @失败时使用'@ Sucess'和'@ Failed' – Borodin