Thanks for the response. It is hard to take "Are you being deliberately thick?" as not hostile.

The problem is large so I provided only a subset of what I am trying to solve, which appears confusing to folks. What I posted is an attempt to translate an algebraic solution into an expanded solution.

When that failed in the previous post, for this post I was attempting to see what folks did in the way of "paging" when programs got too big for memory. It appears this question is to abstract for this forum.

I've completed the first step which was to manually create array of arrays so I can page part of the data out to a database. With this I am up to 16 million array elements - only 8 million more to go. ;~)
$|=1; $/ = ','; my @letters; my @words; $words[0]=0; my $idxop; open POSTFIX, '<', 'postfix.txt' or die $!; while( my $op = <POSTFIX> ) { $idxop++; chomp $op; chop $op if $op =~ tr[\n][\n]; ## remove any trailing newline print "$idxop ($op) WORDS: $#words; LETTERS: $#letters\n"; if( $op eq 'x' ) { print "MULTIPY\n"; ## GRAB LAST TWO ELEMENTS FROM WORDS BY RANGES x1->x2-1;x2->x3 +-1 my $x3=pop(@words); my $x2=pop(@words); my $x1=pop(@words); my $elements=$x3-$x1; ## APPEND NEW VALUES ON TOP OF STACK $idx=$x3; for (my $i=$x2; $i<$x3; $i++) { for (my $j=$x1; $j<$x2; $j++) { $letters[$idx++]= $letters[$j] . $letters[$i]; } print "AT: $i toward $x3 with $#letters\n"; } ## DELETE OLD ELEMENTS splice @letters,$x1,$x3-$x1; ## PUSH POINTERS TO ENDS OF NEW ALGOMATED ELEMENT push(@words,$x1); $elements=$idx-$elements; push(@words,$elements); } elsif( $op eq '+' ) { print " ADD\n"; ## GRAB LAST TWO ELEMENTS FROM WORDS BY RANGES x1->x2-1;x2->x3 +-1 my $x3=pop(@words); my $x2=pop(@words); my $x1=pop(@words); ## PUSH POINTERS TO ENDS OF NEW ALGOMATED ELEMENT push(@words,$x1); push(@words,$x3); } elsif( $op =~ m/^\d+$/ ) { print " STORE NUMBER $op\n"; push @letters, pack 'v', $op ; #push @letters, $op ; $words[$#words+1]=$#letters+1; } else { die "Bad '$op' at position;" . tell( POSTFIX ); } }

In reply to Re^2: Out of Memory 2. by Anonymous Monk
in thread Out of Memory 2. by dneedles

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.