Trying to write a program that would read a file in, replace 'fred' with 'Valentine', write to file with .out as extension. I was able to accomplish this, but then I tried modified my code with what was in the book, (Learning Perl), and then got an 'requires explicit package name' for both my in and out files. Below is my code
#! /usr/bin/perl use v5.14; use warnings; ## 2/7/19 my $in = $ARGV[0]; my $out = $in; $^I = ".out"; while (<$in_fn>) { #take one line of input at a time chomp; s/fred/Valentine/gi; print $out_fh $_; }
TIA The catfish
In reply to Explicit Package? by catfish1116
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |