#returns the sum of two numbers...woohooo! yeah! hurrah! go go go! sub add($$) { my ($Val1, $Val2) = @_; my ($Result, $Tmp, $In_Mente); (length($Val1) < length($Val2)) ? ($Val1, $Val2)=($Val2, $Val1):0; while (length($Val2) || length($Val1)) { $Tmp = substr($Val1,-1,1) + substr($Val2, -1, 1) + $In_Mente; if ($Tmp > 9) { $In_Mente = 1; $Tmp -= 10;} else { $In_Mente = ''; } $Result = $Tmp . $Result; substr($Val1, -1, 1) = undef; substr($Val2, -1, 1) = undef; my $FResult = $Result; last if ($In_Mente == 0 && !length($Val2)); } $Result = $Val1 . $Result; return $Result; } print add( '758347583475824708465850936890539684658943757345975984752849365497545 +795960625230652406542096545654396529602555796453760493262845932848528 +465284698946983489698348968953896085976085938896556980853272085924509 +275205062523065240654209654565439652960255579645376049326284593284852 +846528469894698348969834896895389608597608593889655698085327208592450 +927520545497858944986599457743276035860935689348693496896892469284698 +938496893248683563969350683680363509090349639065903596953', '285725894275576849327508974289653847683579346753477201532635062523065 +240654209654565439652960255579645376049326284593284852846528469894698 +348969834896895389608597608593889655698085327208592450927520506252306 +524065420965456543965296025557964537604932628459328485284652846989469 +834896983489689538960859760859388965569808532720859245092752059726509 +4270' );

In reply to oldschool math by Anonymous Monk

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.