Please send questions to
st10@humboldt.edu .
#!/usr/bin/perl -w
#######################################################
# lect08_in_place
#
# demonstrate in-place editing of files, storing
# backups in .bak
#
# modified by Sharon Tuttle from "Learning Perl",
# by Schartz and Phoenix
#
# last modified: 10-11-04
#######################################################
use strict;
chomp(my $date = `date`); # or my $date = localtime;
@ARGV = glob "fred*.dat"
or die "no files found";
# this creates a backup file --- more on that in a bit
$^I = ".bak";
while (<>)
{
s/^Author:.*/Author: Randal L. Schwartz/;
s/^Phone:.*\n//;
s/^Date:.*/Date: $date/;
print;
}
# end of lect08_in_place