[root@wx03 5]# cat a5.pl
END {print cccccccccccc."
"};
print "aaaaaaaaaaaaa
";
BEGIN {print bbbbbbbbbbbbbb."
"};
[root@wx03 5]# perl a5.pl
bbbbbbbbbbbbbb
aaaaaaaaaaaaa
cccccccccccc
根据结果,我们得出,BEGIN是在Perl语言运行最开始运行的块,END是在Perl语言运行最后运行的块,并注意BEGIN和END必须是大写的。