格式的主要问题是对全局变量的依赖。有关格式的其他问题,请参见
Perl Best Practices
现代的解决方案是
Perl6::Form
下面是格式代码到
Perl6::窗体
. 我不知道
很好,所以可能有一些方法可以使它更好或更真实地与原来的例子:
#!/usr/bin/perl
use strict;
use warnings;
use Perl6::Form;
while(<DATA>) {
my ($aprille, $lorem) = split(/\|/, $_, 2);
print form(
"{>} {[[[[[[[[[[[[[[[[[[[[[[[[} | {[[[[[[[[[[[[[[[[[[}",
$., $aprille, $lorem,
" | ",
);
}
__DATA__
WHAN that Aprille with his shoures soote |Lorem ipsum dolor sit amet,
The droghte of Marche hath perced to the roote,|consectetur adipisicing elit,
And bathed every veyne in swich licour, |sed do eiusmod tempor
Of which vertu engendred is the flour; |incididunt ut labore et dolore
Whan Zephirus eek with his swete breeth |magna aliqua. Ut enim ad minim
Inspired hath in every holt and heeth |veniam, quis nostrud
The tendre croppes, and the yonge sonne |exercitation exercitation
Hath in the Ram his halfe cours y-ronne, |ullamco laboris nisi ut ali-
And smale fowles maken melodye, |quip ex ea commodo conse-
That slepen al the night with open ye, |quat. Duis aute irure dolor
So priketh hem nature in hir corages: |in reprehenderit in volup-
Than longen folk to goon on pilgrimages, |tate velit esse cillium dol-
And palmers for to seken straunge strondes, |ore eu fugiat nulla pariatur.
To ferne halwes, couthe in sondry londes; |Lorem ipsum dolor sit amet,
And specially, from every shires ende |consectetur adipisicing elit,
Of Engelond, to Caunterbury they wende, |sed do eiusmod tempor
The holy blisful martir for to seke, |incididunt ut labore et dolore
That hem hath holpen, whan that they were seke.|magna aliqua. Ut enim ad minim
And now for something completely different. Nice plumage.|Norwegian blue.