Re: [问题] 请问如何在{}里面使用\1?

楼主: lgen7604   2013-06-18 23:46:44
根据你想做的内容我想到的作法如下
my $line = 'C+10AAAAAAAAAAT-3CGCA';
$line =~ s/((\d+)[ACGTNacgtn]+)/substr($1, length($2)+$2)/eg;
使用到的观念包含:
length function
substr function
substitute with the e modifier
关于 e modifier 的参考资料
http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators
※ 引述《CindyLinz (Cindy Wang)》之铭言:
: ※ 引述《scwg ( )》之铭言:
: : 根据 http://perl5.git.perl.org/perl.git/blob?f=dquote_static.c
: : S_regcurly() 在 parse 的时候 { 之后一定要接数字
作者: CindyLinz (Cindy Wang)   2013-06-19 17:27:00
这个不错 :p
作者: YMLS (流逝于指缝的细沙)   2013-07-18 21:59:00
这个方法很赞喔!

Links booklink

Contact Us: admin [ a t ] ucptt.com