#!perl -w open(FILE, "data.txt"); #opens data.txt in read-mode while(){ #reads line by line from FILE which is the filehandle for data.txt chomp; print "Saw $_ in data.txt\n"; #shows you what we have read } close FILE; #close the file. $a = "keylogger.dat"; open FILE, ">$a" or die; #opens file to be written to while(<>){ #while we're getting input from the keyboard print FILE $_; #write it to our file } close FILE; #then close our file.