首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

[D]Perl 小程序求批改

2012-08-03 
[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”。

热点排行