请看下$_和$tmp有什么区别??

版主,我有个问题,像下面这样格式的文本,用你以前给那个模式,怎么写 $end 啊

>P30443|1A01_HUMAN HLA class I histocompatibility antigen, A-1 alpha chain precursor - Homo sapiens (Human)
MAVMAPRTLLLLLSGALALTQTWAGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRF
DSDAASQKMEPRAPWIEQEGPEYWDQETRNMKAHSQTDRANLGTLRGYYNQSEDGSHTIQ
IMYGCDVGPDGRFLRGYRQDAYDGKDYIALNEDLRSWTAADMAAQITKRKWEAVHAAEQR
RVYLEGRCVDGLRRYLENGKETLQRTDPPKTHMTHHPISDHEATLRCWALGFYPAEITLT
WQRDGEDQTQDTELVETRPAGDGTFQKWAAVVVPSGEEQRYTCHVQHEGLPKPLTLRWEL
SSQPTIPIVGIIAGLVLLGAVITGAVVAAVMWRRKSSDRKGGSYTQAASSDSAQGSDVSL
TDDKV
>P39877|1A01_HUMAN HLA class I histocompatibility antigen, A-1 alpha chain precursor - Homo sapiens (Human)
MAVMAPRTLLLLLSGALALTQTWAGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRF
DSDAASQKMEPRAPWIEQEGPEYWDQETRNMKAHSQTDRANLGTLRGYYNQSEDGSHTIQ
IMYGCDVGPDGRFLRGYRQDAYDGKDYIALNEDLRSWTAADMAAQITKRKWEAVHAAEQR
RVYLEGRCVDGLRRYLENGKETLQRTDPPKTHMTHHPISDHEATLRCWALGFYPAEITLT
WQRDGEDQTQDTELVETRPAGDGTFQKWAAVVVPSGEEQRYTCHVQHEGLPKPLTLRWEL
SSQPTIPIVGIIAGLVLLGAVITGAVVAAVMWRRKSSDRKGGSYTQAASSDSAQGSDVSL
TAKDLDLV
>P323343|1A01_HUMAN HLA class I histocompatibility antigen, A-1 alpha chain precursor - Homo sapiens (Human)
MAVMAPRTLLLLLSGALALTQTWAGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRF
DSDAASQKMEPRAPWIEQEGPEYWDQETRNMKAHSQTDRANLGTLRGYYNQSEDGSHTIQ
IMYGCDVGPDGRFLRGYRQDAYDGKDYIALNEDLRSWTAADMAAQITKRKWEAVHAAEQR
RVYLEGRCVDGLRRYLENGKETLQRTDPPKTHMTHHPISDHEATLRCWALGFYPAEITLT
WQRDGEDQTQDTELVETRPAGDGTFQKWAAVVVPSGEEQRYTCHVQHEGLPKPLTLRWEL
SSQPTIPIVGIIAGLVLLGAVITGAVVAAVMWRRKSSDRKGGSYTQAASSDSAQGSDVSL
TACKV


QUOTE:
原帖由 __lxmxn__ 于 2008-7-11 07:34 发表
read the perl documentation in perldoc perlop

modify the section 1 with
if ($_ =~ /$start/ .. $_ =~ /$end/)

and section 2 with
if ($tmp =~ /$start/ .. $tmp =~ /$end/)

You sure?
你好,我新入此坛,能讲下你是用什么方法把代码像你那样发上去的呢?很炫啊

还有你是什么编辑器,很强大的样子~


QUOTE:
原帖由 mouse.rice 于 2008-7-11 11:40 发表


You sure?

Of course.
具体需要实现什么功能呢?


QUOTE:
原帖由 __lxmxn__ 于 2008-7-12 08:54 发表
具体需要实现什么功能呢?

用 if (/$start/ .. /$end/) 的模式来匹配其中的一段, $start 好写, $end 不知道怎么写啊


QUOTE:
原帖由 cobrawgl 于 2008-7-12 08:58 发表
用 if (/$start/ .. /$end/) 的模式来匹配其中的一段, $start 好写, $end 不知道怎么写啊

还是没明白你要匹配哪一段,能否给个例子呢?


QUOTE:
原帖由 __lxmxn__ 于 2008-7-13 03:55 发表

还是没明白你要匹配哪一段,能否给个例子呢?

比如,给出 >P30443,要求匹配下面这段:

>P30443|1A01_HUMAN HLA class I histocompatibility antigen, A-1 alpha chain precursor - Homo sapiens (Human)
MAVMAPRTLLLLLSGALALTQTWAGSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRF
DSDAASQKMEPRAPWIEQEGPEYWDQETRNMKAHSQTDRANLGTLRGYYNQSEDGSHTIQ
IMYGCDVGPDGRFLRGYRQDAYDGKDYIALNEDLRSWTAADMAAQITKRKWEAVHAAEQR
RVYLEGRCVDGLRRYLENGKETLQRTDPPKTHMTHHPISDHEATLRCWALGFYPAEITLT
WQRDGEDQTQDTELVETRPAGDGTFQKWAAVVVPSGEEQRYTCHVQHEGLPKPLTLRWEL
SSQPTIPIVGIIAGLVLLGAVITGAVVAAVMWRRKSSDRKGGSYTQAASSDSAQGSDVSL
TDDKV