foreach my $nucleotide(@nucleotide_array) { chomp $nucleotide; my($T,$G,$C,$A); #These mutations rates reflect 10^-5 if ($nucleotide eq 'A'){ # $T=.1;$G=.2;$C=.3;$A=.7; my $score = (int rand(100000))/100000; if( $score>=00000 && $score<=.00033){ $nucleotide='T';} if( $score>=.000334 && $score<=.00066){ $nucleotide='G';} if( $score>=.00067 && $score<=.00099){ $nucleotide='C';} # if( $score>=.300 && $score<=1.00){ Do NOTHING } } } elsif ($nucleotide eq 'T'){ # $A=.1;$G=.2;$C=.3;$T=.7; my $score = (int rand(100000))/100000; if( $score>=00000 && $score<=.000333){ $nucleotide='A';} if( $score>=.00034 && $score<=.00066){ $nucleotide='G';} if( $score>=.00067 && $score<=.00099){ $nucleotide='C';} #if( $score>=.300 && $score<=1.00){ DO NOTHING } } } elsif ($nucleotide eq 'C'){ # $T=.1;$G=.2;$A=.3;$C=.7; my $score = (int rand(100000))/100000; if( $score>=00000 && $score<=.00033){ $nucleotide='T';} if( $score>=.00034 && $score<=.00066){ $nucleotide='G';} if( $score>=.00067 && $score<=.00099){ $nucleotide='A';} #if( $score>=.300 && $score<=1.00){ #No mutation} } elsif ($nucleotide eq 'G'){ # $T=.1;$A=.2;$C=.3;$G=.7; my $score = (int rand(100000))/100000; if( $score>=00000 && $score<=.00033){ $nucleotide='T';} if( $score>=.00034 && $score<=.00066){ $nucleotide='A';} if( $score>=.00067 && $score<=.00099){ $nucleotide='C';} #if( $score>=.300 && $score<=1.00){ #No mutation} } $new_string= $new_string . $nucleotide;