How about reading one character from each of the files and depending on the current value of character from data2.txt print out either lowercased or uppercased value of the character from data1.txt. Something like this (no error checking etc, but you see the idea):
open D1, 'data1.txt';
open D2, 'data2.txt';
my ($c1, $c2);
while (read D2, $c2, 1) {
read D1, $c1, 1;
print $c2 eq 'N' ? lc($c1) : $c1;
}
close D2;
close D1;
This produces the desired output:
>seq1
GGTacacagaagccaaagcaggctccaggctctgagctgtcagcacagagaccgaT
>seq2
GTCTCTGTCTCtaaaataaataaacattaaaaaaattttaaaagaaaaGATTCTCTCC
-- Kirill