Hey, monks.

I've decided to give up on my stock thing until later, when I don't have a massive headache from trying over and over again. So, I've moved on to a much simpler one to try. I've managed to mess that one up too. So, I'm trying to make the first number go up by 10%, second number go down by 5%, third up by 10%, fourth down by 5%, and so on. If you're wondering about the 1100 and 950, I've already multiplied 1.1% and 0.95% by 1000 to save lines. So yeah, my problem is that when I run it, nothing comes out. It's just blank. I've tried rewriting it, but to no avail. Maybe I'm just doing this totally wrong.

use warnings; use strict; my @array; print "Enter the number of years: "; my $i = <STDIN>; my @p = 100; sub number { for(1..100) { if ($_ % 2) { my $y = number($p[-1]*1100); push @array, $y; } else { my $z = number($p[-1]*950); push @array, $z; } } } print $array[$i-1];

In reply to recursive. again. by derpp

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.