Hello Monks,

When compile my perl program, I got an error as 'Memory Stack overflow'. Pls help me to correct this problem.

Please find my codings

My perl code:-- $file=~s#<tbody>((?:[^<]+|<(?!/?tbody>))+</tbody>(?:\s*<tbody>(?:[^<]+ +|<(?!/?tbody>))+</tbody>)*)#"<tbody>\n".${TableBody(\$1)}."\n</tbody> +"#gies; sub TableBody { my ($line) = @_; $temp = "$$line"; $temp =~s#</tbody>$##; $temp =~s#\t#</para></entry><entry><para>#g; $temp ="<row><entry><para>$temp</para></entry></row>"; $temp =~s#<tbody>#<row><entry><para>#g; $temp =~s#</tbody>#</para></entry></row>#g; return \$temp; } My input is:-- <tbody>one two three</tbody> <tbody>one two three</tbody> <tbody>one two three</tbody> <tbody>one two three</tbody> My output is:-- <tbody> <row><entry><para>one</para></entry><entry><para>two</para></entry><en +try><para>three</para></entry></row> <row><entry><para>one</para></entry><entry><para>two</para></entry><en +try><para>three</para></entry></row> <row><entry><para>one</para></entry><entry><para>two</para></entry><en +try><para>three</para></entry></row> <row><entry><para>one</para></entry><entry><para>two</para></entry><en +try><para>three</para></entry></row> </tbody>

It works well. But if the number of rows in the input exceeds 25, the "Memory stack overflow" error comes.

Pls help me, how to increase stack memory.

thanks


In reply to Stack overflow while performing nested substitutions by sivaramanm

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.