[D]Perl 小程序求批改
[D]Perl 小程序求修改Perl code$^I.bakunless (open IN, a.txt) {die can not open file a.txt\n
[D]Perl 小程序求修改
Perl code$^I=".bak";unless (open IN, "<a.txt") {die "can not open file a.txt\n";}unless (open OUT,">out.txt") {die "can not open file out\n";}while(<IN>){if(/^#!/){$_.="## copyright (c) 2012 by Cindy\n";}print OUT "$_";}
把指定文件内#!后加上版权说明,可以调通,但出来的文件没有加入版权说明
----------------------
Double行动:
原帖分数:20
帖子加分:20
[解决办法]我这儿没问题。检查以下两点:
1. a.txt中有没有“#!”开头的行?
2. 注意你的输出文件是“out.txt”。