in reply to Usage of File Handles

open CONFIG, '<', 'three_Freds';

In addition to what the others have pointed out, I would very strongly recommend you use the more modern form of open with lexical file handles instead of global handles, and that you check the return value of the function for errors. That would look something like the following. By the way, what is the point of the $three_Freds variable if you're not using it? Also, note that s/\n/Wilma/g; won't do anything since you're removing the newline on each line with chomp.

#!/usr/bin/env perl use warnings; use 5.012; my $in_filename = 'three_Freds'; my $out_filename = 'three_Freds.out'; open my $config_fh, '<', $in_filename or die "$in_filename: $!"; open my $output_fh, '>', $out_filename or die "$out_filename: $!"; my $three_Freds = $ARGV[0]; if (! defined $three_Freds) { die "Usage: $0 filename"; } while (<$config_fh>) { chomp; s/fred/\n/gi; s/Wilma/Fred/gi; s/\n/Wilma/g; print $output_fh $_; }