error_reporting(E_ALL);
ini_set("display_errors", 1);
#!/usr/bin/perl
use strict;
use warnings;
my $filenum = 0;
my $fd;
while(<>) {
if (not $_ or $_ eq "\n" or /^--/) {
if (defined $fd) {
close $fd;
undef $fd;
}
next;
}
if (not defined $fd) {
my $s = sprintf("%04d.sql", $filenum++);
open $fd, ">$s";
print STDERR "$s...\n";
}
print $fd $_;
}
close $fd if defined $fd;
Т.е. вопрос «что делать» так и остается открытым.