in reply to Replace ID names from FILE1 to FILE2

jemo:

It looks like you just need to open the files and read from them instead of the standard input:

open my $FILE1, '<', "FILE1.TXT" or die "Can't open FILE1: $!\n"; while (<$FILE1>) { ... }

...roboticus

When your only tool is a hammer, all problems look like your thumb.