my @arrays = ( [] ); my $length = 0; while (<>) { if (length $_ + $length >= 24 * 1024) { push @arrays,[$_]; $length = length $_; } else { push @{$arrays[-1]},$_; $length += length $_; } } #### -- Joost downtime n. The period during which a system is error-free and immune from user input.