🌱 Spit file into many files

$/ = '# ';               # set the input record separator
my $base = 'filename';
my $i = 0;
while (<>) {                  # read one section at a time
  my $filename = "$base$i";   # generate a new filename
  open(OUT, ">$filename.txt")     # create and write a new file
    or die "Can't open $filename: $!\n";
  print OUT;
  $i++;
}
Made by Brandon . If you find this project useful you can donate.