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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |