Mortal Fibonacci Rabbits

Author: L. Grondin

http://rosalind.info/problems/fibd/

Sample input

6 3

Sample outut

4

Source code: fibd-grondilu.pl

use v6;

sub MAIN(Int $n = 6, Int $m = 3) {
    my @population = (1, 0 xx ($m-1)).flat;
    for 1 .. $n-1 -> \n {
        @population.unshift: [+] @population[1..*-1];  # reproduction
        @population.pop;                               # death
    }

    say [+] @population;
}