catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Explicit Package?
by toolic (Bishop) on Feb 07, 2019 at 19:39 UTC | |
Re: Explicit Package?
by haukex (Archbishop) on Feb 08, 2019 at 07:29 UTC | |
Re: Explicit Package?
by jimpudar (Pilgrim) on Feb 08, 2019 at 01:49 UTC | |
Re: Explicit Package?
by Anonymous Monk on Feb 09, 2019 at 03:57 UTC |
Back to
Seekers of Perl Wisdom