3 # Write a program that makes a modified copy of a text file. In the copy,
4 # every string Fred (case-insensitive) should be replaced with Larry. (So,
5 # Manfred Mann should become ManLarry Mann.) The input file name should be
6 # given on the command line (don't ask the user!), and the output filename
7 # should be the corresponding file name ending with .out.
13 if (scalar(@ARGV) != 1) {
14 die "Usage: $0 filename";
16 my $filepath = ($ARGV[0] =~ s/.[^.]*\z/.out/r);
17 open my $fh, ">", $filepath or die "Unable to write to '$filepath': $!";