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 join(':', split(/,/,$_)); # print "\n"; @data = split(/,/,$_); } close FILE; #close the file.