use strict; use warnings; open my $fh, '<', 'filename.dat'; binmode($fh); my $len = -s $fh; my $split_length = $length / 5; #would split 10gb into 2gb chunks my $split_fh = $fh . 'split'; #creates 'filename.split' my $num = '1'; for ( 1 .. 5 ) { read $fh, $buf, $split_length; open my $out_file, '>', $split_fh . $num; #vreates '$filename.split000, 001, 002 ect binmode($out_file); print $out_file, $buf; close($out_file); $num++; } close($fh);