in reply to Find Replace code broke and I cannot seem to fix it
Always use strictures (use strict; use warnings;). Don't use global variables in subs. Don't nest named subs - it probably isn't doing what you expect.
Your 'wanted' sub contains:
foreach my $line (@mapper) { my ($oldaddr, $newaddr,) = split(/\t/, $line, 2); }
which slurps a file (bad) then does something with each line from the file and throws away the result ($oldaddr and $newaddr are never used). That seems wrong. Later on a different for loop contains:
print "<MIKE Changing OLD IP ADDRESS: $oldaddr\n"; print "<MIKE To NEW IP ADDRESS: $newaddr\n";
which uses $oldaddr and $newaddr, although they are not declared. Note that they are not the variables of the same name used elsewhere.
So, fix the structural errors and the errors that strictures throw up, then come back with any remaining problems. It would be nice if they were isolated into a chunk of sample code that we can run however!
|
|---|