欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

perl 指定長度并生成一個隨機(jī)的DNA序列的腳本代碼

 更新時間:2013年03月01日 11:23:07   作者:  
perl 指定長度并生成一個隨機(jī)的DNA序列的代碼,有需要的朋友可以參考下

復(fù)制代碼 代碼如下:

#!/bin/perl

use strict; 
use warnings;

#進(jìn)行定義 
my @dna; 
my $dna_length; 
my $newbase; 
my $i=0; 

print "please input the DNA length\n"; 
chomp($dna_length=<>); 

while($i<$dna_length) 

  #從四個堿基中隨機(jī)選取一個 
  my(@nucleotides)=qw/A T G C/; 
  $newbase=$nucleotides[rand @nucleotides]; 

  #將隨機(jī)生成的序列添加到@dna的數(shù)組中 
  push(@dna,$newbase); 
  ++$i; 

print "@dna";

相關(guān)文章

最新評論