SPUG:Re: for help
Jeremy Mates
jmates at sial.org
Thu Feb 6 18:04:14 CST 2003
* Liu, Zhu <Liu.Zhu at mayo.edu>
> Hi, everybody, I experienced a very stupid simple problem for three
> hours. I just want to extract three substrings from one string. In the
> beginning of the string there are two spaces like
> 207 MFSNLASDEQDSVRLLAV---EAC--VNIAQLLPQEDLEALVMPTLRQAAEDKSWRVRYM 261
>
> My part code is
> if( $line =~ /^\s+\d+.*\d$/)
> {
> ($part, $part2, $part3) = /\s+(\d+)\s(.*)\s+(\d+)/;
> }
($part, $part2, $part2) = $line =~ /\s+(\d+)\s(.*)\s+(\d+)/;
Without binding the regex to $line, the regex was being done on $_.
For more help with regex, see:
http://www.perldoc.com/perl5.8.0/pod/perlretut.html
http://japhy.perlmonk.org/book/
More information about the spug-list
mailing list