SPUG:for help

Umar Cheema umar at drizzle.com
Thu Feb 6 17:59:06 CST 2003


Instead of 
($part, $part2, $part3) = /\s+(\d+)\s(.*)\s+(\d+)/;

Try 
($part, $part2, $part3) = $line =~ /\s+(\d+)\s(.*)\s+(\d+)/;



On Wed, 29 Jan 2003, Liu, Zhu wrote:

> 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+)/;
> }
> 
> it always tells me "Use of uninitialized value in pattern match (m//)", so if I use the following codes
> if( $line =~ /^\s+\d+.*\d$/)
> {
> 	($emptypart, $start, $part, $end) = split /\s+/, $line, 4;
> }
> 
> This time I can get the items. 
> 
> So my question is why parentheses can't catch the substrings?
> 
> Thanks,
> zhu liu
> 
> _____________________________________________________________
> Seattle Perl Users Group Mailing List  
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org
> 




More information about the spug-list mailing list