perl应用:从NCBI提供的信息中获取需要的序列下use Scalar



use strict;
use warnings;

my $annotation =' ';
my $dna =' ';
my $record =' ';
my $save_input_separator =$/;

open (DNAFILENAME,'f:\\perl\\strawBerry.gb')||die("can not open the file!");
$/ = "//\n";
$record = <DNAFILENAME>;
($annotation,$dna) = ($record=~/^(LOCUS.*ORIGIN\s*\n) (.*)\/\/\n/s);
print "$annotation \n\n\n$dna\n";

这里面关键就是用到了模式匹配:

($annotation,$dna) = ($record=~/^(LOCUS.*ORIGIN\s*\n) (.*)\/\/\n/s);

这一行表示,如果在$record中可以匹配到(Locus.*ORIGIN\s*\n)   和(.*)   那么就将第一个括号中的数值赋给$annotation,把第二个括号中匹配的内容赋给$dna.

另外一个就是$/这个变量的用法

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...