使用perl添加页脚

时间:2013-12-16 17:54:26

标签: perl header footer

我的情况很小。首先,我有一个拆分文件列表。 Xaa通过Xal。我的目标是为每个人添加页眉和页脚。我想出了如何添加标题。那部分完成了。现在我只需要知道如何插入页脚。有什么建议?这是脚本。

open(M,"<","xak.txt");
@m = <M>;
close(M);
open(M,">","xak.txt");
print M "LINE: while (<>) {\n";
print M @m;
close(M);

此脚本完美添加了标题LINE: while (<>) {\n。我现在只想添加

    print;
}

位于我的文件底部,或更多\tprint;\n}。我觉得我很接近,但我只需要知道在文件顶部添加一些与底部相比的区别。

1 个答案:

答案 0 :(得分:0)

只需在数组后添加:

open(M,"<","xak.txt");
@m = <M>;
close(M);
open(M,">","xak.txt");
print M "LINE: while (<>) {\n";
print M @m;
print M "\tprint;\n}";
close(M);