在将某些数据行从文件复制到数组中然后使用命令print MAIL "$line" ;
使用Perl发送包含这些文件内容的邮件时,我遇到了一些问题。
当我收到包含文件内容的邮件时,文件之间有一些意外的字符,文件本身没有。
我不确定为什么会这样,因为它看起来很简单。
my @mail_contents=<MAIL_CONTENT>;
chomp(@mail_contents);
my $line="";
foreach $line (@mail_contents)
{
if($line =~/some pattern matching/)
{
$var1 = $line;
}
if($line =~/some pattern matching/)
{
$var2= $line;
}
}
my @arr_var1=split(/&/,$var1);
my @arr_var2=split(/&/,$var2);
foreach my $OR (@arr_var1)
{
print MAIL "$OR";
}
foreach my $FTD (@arr_var2)
{
print MAIL "$FTD";
}
文件内容:
<br> <font size=5> My name is Maxintown </font> <br> <br> <table> <tr> <td> <font color=blue> How are you today </font> </td> <td> <font color=blue> How do you do </font> </td> </tr>
邮件内容:
My name is Maxintown
How do are yo!u today
How do you d!o