in reply to Substitute data issue

You could make it look better (but probably less efficient, although you should benchmark this) by using a hash for the substitution.

my %subst = ( 'AAA' => 'EEE', 'CCC' => 'NEWWORD', 'UUU' => 'NEW', 'ERD' => 'IPK' ); my $pattern = join('|', keys %subst);
and replacing the body of the foreach by:
$line =~ s/($pattern)/$subst{$1}/gi;
Note: this is untested.

Hope this helps, -gjb-

Update: thanks to broquaint for pointing out that I should drop the /e as regex modifier. Silly, I wasn't thinking.