use strict; while() { chomp; open FH, ">$..line"; print FH $_; close FH; } __DATA__ this is a file that will be split by line into files.