hi I have a very big code file i won't bore you with
I will paraphrase what it does, and maybe you can help me figure out why its crashing/giving me an infinite loop

what it does is take a string and pick out the real/complex part if it is in rectangular form, or pick out the magnitude and angle if it is in polar form. What i want is if it is in polar form, i want to make the real/complex data represented in @constructed reflect the polar form of the rectangular data. So, really, in order to get this data, i'm trying to get constructComplex to call itself.
$x = "3 _ 4"; #in polar form.. 3 is mag and 4 is angle sub constructComplex{ my($value1, $real, $complex, $magnitude, $angle, @construct, @const +ructPolar, $isinPolarForm, $isinRectForm); $value1 = $_[0]; if($isinPolarForm) { #uses $value1 to pick out the magnitude and angle $magnitude = blah; $angle = blah; ###point of interest### @constructPolar = &constructComplex(&PolarToRect($value1)); $real = $constructPolar[0]; $complex = $constructPolar[2]; ###point of interest### } if($isinRectForm) { $real = blah; $complex = blah; #haven't implemented getting polar values from rect form because + getting the rect values from polar doesn't work yet } $construct[0] = $real; $construct[1] = $complex; $construct[2] = $magnitude; $construct[3] = $angle; } sub PolarToRect { my($magnitude, $angle, $real, $complex); #does it return $magnitude . " _ " $angle; }

2005-11-08 Retitled by broquaint, as per Monastery guidelines
Original title: 'Recursion!!'


In reply to Constructing complex numbers using recursion by moltar512

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.