我想正确显示此格式。现在,我将所有内容集中在一起。我想在多行上打印结果。希望有人可以帮我解决这个问题。
my $name = "Fred Flinstone";
my $address = "Cave Stone Road 345";
my $city = "Cobblestone";
my $state = "Rock";
my $zip = "13131";
print ("<span class='titel'>");
$~ = "MULTILINE";
write;
format MULTILINE =
===============================
| @<<<<<<<<<<<<<<<<<<<<<<<<<< |
$name
| @<<<<<<<<<<<<<<<<<<<<<<<<<< |
$address
| @<<<<<<<<<<<<<<<<, @< @<<<< |
$city, $state, $zip
===============================
@*
.
print ("</span>");
print ("<br><br>");
答案 0 :(得分:1)
只需添加\n
符号,即“行尾”:
my $name = "Fred Flinstone";
my $address = "Cave Stone Road 345";
my $city = "Cobblestone";
my $state = "Rock";
my $zip = "13131";
print ("<span class='titel'>\n");
$~ = "MULTILINE";
write;
format MULTILINE =
===============================
| @<<<<<<<<<<<<<<<<<<<<<<<<<< |
$name
| @<<<<<<<<<<<<<<<<<<<<<<<<<< |
$address
| @<<<<<<<<<<<<<<<<, @< @<<<< |
$city, $state, $zip
===============================
@*
.
print ("</span>\n");
print ("<br><br>\n");
会返回:
<span class='titel'>
===============================
| Fred Flinstone |
| Cave Stone Road 345 |
| Cobblestone , Ro 13131 |
===============================
</span>
<br><br>