小粉自4
tuti2xx
关注数: 0
粉丝数: 12
发帖数: 11
关注贴吧数: 15
各位大师,我想问一下perl中?!与!的区别
各位大师,我想问一下perl中?!与!的区别
求大师讲解 这个程序为什么总是出错啊 my $fh; my $record; my $dna; my $annotation; my $offset; my $library = *genbank/sequence.gb*; $fh = &open_file($library); $offset = tell($fh); while($record = &get_next_record($fh)){ ($annotation,$dna) = &get_annotation_and_dna($record); if(&search_sequence($dna,*AAA[CG].*)){ print "Sequence found in record at offset $offset.\n"; } if(&search_annotation($annotation,*synthetic construct*)){ print "Annotation found in record at offset $offset.\n"; } $offset = tell($fh); } exit; #Subroutines sub open_file{ my ($filename) = @_; my $fh; open $fh,$filename or die "Cannot open the file *$filename*:$!"; return $fh; } sub get_next_record{ my ($fh) = @_; my $offset; my $record; my $save_input_separator = $/; $/ = "//\n"; $record = <$fh>; $/ = $save_input_separator; return $record; } sub get_annotation_and_dna{ my ($record) = @_; my $annotation; my $dna; ($annotation,$dna) = ($record =~ /^(LOCUS.*ORIGIN\s*\n)(.*)\/\/\n/s); $dna =~ s/[\s0-9]//g; return ($annotation,$dna); } sub search_sequence{ my ($sequence,$pattern) = @_; my @locations; while ($sequence =~ /$pattern/ig){ push (@locations,pos); } return @locations; } sub search_annotation{ my ($annotation,$pattern) = @_; my @locations; while ($annotation =~ /$pattern/isg){ push (@locations,pos); } return @locations; }
我下不了intermediate perl,哪位前辈有?可以给我传一份吗
1
下一页