my $output_file = 'output_0000'; my $file_size = 0; open(STDOUT,>,$output_file) or die "Error opening $output_file for writing, "; while (my $line = <>) { do_something($line); if ($file_size > 50000) { close STDOUT or die "Error closing $output_file, "; $output_file++; # magic increment open(STDOUT,>,$output_file) or die "Error opening $output_file for writing, "; $file_size = 0; } print $line; }
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to Re: limit output filesize
by QM
in thread limit output filesize
by rogue90
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |