in reply to dividend with recursive routine
my $SHARES = 1000; my $DIVIDEND = 0.0678; my $YEARS = 20; sub stock { my ($shares, $years) = @_; $years >= 1 ? stock(int($shares * (1 + $DIVIDEND)), $years - 1) : +$shares; } print stock $SHARES, $YEARS; [download]