in reply to Controlling the Size of an Array based on its file source.

If you mean controlling the size of the data in the array, you can do something like:

my @arrays = ( [] ); my $length = 0; while (<>) { if (length $_ + $length >= 24 * 1024) { push @arrays,[$_]; $length = length $_; } else { push @{$arrays[-1]},$_; $length += length $_; } }
which will fill @arrays with anonymous arrays smaller than 24 Kbytes worth of data (Except when the lines are bigger than 24 Kbytes by themselves) .

Controlling the actual size of the arrays (in terms of allocated memory) is quite a lot trickier (if at all possible) in pure perl.

Another question would of course be: why would you want this anyway?

-- Joost downtime n. The period during which a system is error-free and immune from user input.