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; #### use strict; my($foo) = 'FILE'; open($foo, "data.txt"); #opens data.txt in read-mode while(<$foo>){ #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 $foo; #close the file.