时间:2021-04-26 11:03:42 | 栏目:perl | 点击:次
use strict;
use warnings;
#进行定义
my @dna;
my $dna_length;
my $newbase;
my $i=0;
print "please input the DNA length\n";
chomp($dna_length=<>);
while($i<$dna_length)
{
#从四个碱基中随机选取一个
my(@nucleotides)=qw/A T G C/;
$newbase=$nucleotides[rand @nucleotides];
#将随机生成的序列添加到@dna的数组中
push(@dna,$newbase);
++$i;
}
print "@dna";