in reply to Re^5: out of memory problem
in thread out of memory problem

The way to avoid that problem when you know you are dealing with large scalars, (arrays and hashes too), is to use pass by reference. Either:

sub frobnicate { $_[0] =~ s/foo/bar/g; return; }

Or:

sub frobnicate { my ($ref) = @_; $$ref =~ s/foo/bar/g; return; }

Either way you avoid a lot of copying and the lingering redundant memory usage.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."