in reply to How to best handle memory intensive operations

Use a tie to your array or hash, so it lives in a file (database?) and swaps in transparantly.

There are already database/hash tie modules, but it might not cache the way you want.

sub STORE { my ($self, $index, $value)= @_; ... if index is in range, store item in my array ... else store it to the file. ... if I appended more elements and hit my high-water .... mark, swap out lower items and adjust my range. }