SPUG:for help
Pommert, Daniel
Daniel.Pommert at VerizonWireless.com
Thu Feb 6 17:58:18 CST 2003
Don't you need to say:
($part, $part2, $part3) = $line =~ /\s+(\d+)\s(.*)\s+(\d+)/;
-- Daniel Pommert
-----Original Message-----
From: Liu, Zhu [mailto:Liu.Zhu at mayo.edu]
Sent: Wednesday, January 29, 2003 8:20 PM
To: 'spug-list at mail.pm.org'
Subject: SPUG:for help
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