#!/usr/bin/perl use warnings; use strict; use File::Copy; my($fileName) = $ARGV[0]; print("$fileName \n"); my($find) = "cps***"; my($replace) = "nat***"; if(-e $ARGV[0]) { my($copy) = "$ARGV[0].bak"; copy($ARGV[0], $copy) or die "File cannot be copied. \n"; } else { print "File does not exist. \n"; exit; } open(INPUT,"$copy") or die 'Cannot open file: $!\n'; open(OUTPUT,">$ARGV[0]"); while(){ $_ =~ s/$find/$replace/g; print OUTPUT $_; } close INPUT; close OUTPUT; unlink($copy); print("File $fileName correctly pointed\n"); exit 0; #### Variable "$copy" is not imported at /home/test/.put_on_nat.pl line 25. (Did you mean © instead?) Variable "$copy" is not imported at /home/test/.put_on_nat.pl line 35. (Did you mean © instead?) Global symbol "$copy" requires explicit package name at /home/test/.put_on_nat.pl line 25. Global symbol "$copy" requires explicit package name at /home/test/.put_on_nat.pl line 35. #### "my" variable $copy masks earlier declaration in same scope at /home/test/.put_on_nat.pl line 35. Can't declare string in "my" at /home/test/.put_on_nat.pl line 25, near ")) "