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.
|
|---|