- or download this
my $x = rand(65536);
foreach (@lines) {
...
print $fh_out $_;
$x = ($x + 1) % 65536;
}
- or download this
my $x = 0;
foreach (@lines) {
open(my $fh_out, '>', sprintf('prefix.%04d.txt', $x++)) or die;
print $fh_out $_;
}
- or download this
while (<$fh_in>) {
open(my $fh, '>', sprintf('prefix.%04d.txt', $.)) or die;
print $fh_out $_;
}