http://qs1969.pair.com?node_id=780967


in reply to split file into smaller chunks

I don't think this is necessarily quicker. But it only ever has one filehandle open.

{ local $/ = "\\/n"; my $file_no = 1; open my $fh, '>', "file$file_no" or die $!; while (<>) { print $fh, $_; unless ($. % 1000) { close $fh; $file_no++; open $fh, '>', "file$file_no" or die $!; } } }
--

See the Copyright notice on my home node.

Perl training courses