{local $/="====\n"; while( <> ){ open (NEW, "> $old_file$..txt") || die $!; #open output chomp; print NEW; } }