perl习题解决思路
perl习题
小骆驼书上的,我想问这程序
#! C:\strawberry\perl\bin
#test.pl
$^I=".bak";
while (<>){
if (/^#!/){
$_.="## Copyright(C) 2010\n";
}
}
.\test.pl a
这里的$^I是什么意思,作用在那个目录
------解决方案--------------------
$^I中的字符串会作为备份文件的扩展名,为空时是undef.
小骆驼书上的,我想问这程序
#! C:\strawberry\perl\bin
#test.pl
$^I=".bak";
while (<>){
if (/^#!/){
$_.="## Copyright(C) 2010\n";
}
}
.\test.pl a
这里的$^I是什么意思,作用在那个目录
------解决方案--------------------
$^I中的字符串会作为备份文件的扩展名,为空时是undef.
- Perl code
#!C:\Perl\bin\perl.exe -w #test.pl $^I=".bak"; while (<>) { if (/^#!/) { $_.="## Copyright(C) 2010\n"; } print;#这里加一个输出... }