作为一个小优化,替换:
$roll = int(rand 4) + 1; # $roll is now an integer between 1 and 4 if ($roll == 1) {$base = A;} elsif ($roll == 2) {$base = T;} elsif ($roll == 3) {$base = C;} elsif ($roll == 4) {$base = G;};
同
$base = $dna[int(rand 4)];