* 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.htmlhttp://japhy.perlmonk.org/book/