in reply to Writing all relevant data in one file to a new file with adjustments

pme has given the solution and also corrected implicitly what I am just going to say, but I want to comment it explicitly. When you write:
if($_ =~ /hue/){ $_ =~ s/hue/someword/g; }
you don't really need that if conditional: the substitution operator $_ =~ s/hue/someword/g; will anyway do the substitution only if the input line matches /hue/, so that the three code lines above can be summarized to
$_ =~ s/hue/someword/g;
It can actually be simplified further by noting that that the substitution operator works by default on $_, so that it can be rewritten:
s/hue/someword/g;
but not everyone agrees with that further simplification, some people prefer to explicitly use the $_ variable and the =~ binding operator. The same simplification could have been done in the if conditional (if (/hue/) { # ...), but there is no point of discussing that further since it has already been removed.

Je suis Charlie.