Calculating Expected Offspring

Author: L. Grondin

http://rosalind.info/problems/iev/

Sample input

1 0 0 1 0 1

Sample output

3.5

Source code: iev-grondilu.pl

use v6;

sub MAIN(Str $default-data = "1 0 0 1 0 1") {
    say 2 * [+] <1 1 1 3/4 1/2 0> Z* $default-data.split: " ";
}