关于perl更新多个文件
大家好,我按照教程的方法做实验:有一个名为fred03.dat的文件,内容如下:
Program name:grantie
Author:Gilbert Bates
Company:RockSoft
Department:R&D
Phone:+1 503 555-0095
Date:Tues March 9,2004
Version: 2.1
Size: 21k
statues: Final beta
程序如下:
#!/usr/bin/perl -wuse strict;use diagnostics;chomp(my $date=`date`);$^I = ".bak"; #dot is not ignoredwhile(<>){ s/^Author:.*/Author:Randal L.Schwartz/; s/^Date.*:/Date:$date/; s/^Phone:.*\n//; print;}