Date: 11 Sep 2001 05:54:57 -0700 From: kenlaird@yahoo.com (Laird) Subject: Re: Parsing problem (Please HELP ) Message-Id: <94a02505.0109110454.15a9f2b3@posting.google.com> Hi everybody, I changed the file in order to be more explicit. This is what it looks like. --- # name-1 service numberone COMMENTS # name-2 service numbertwo COMMENTS # name-3 service numberthree # name-4 name-5 COMMENTS service numberfour service numberfive # name-other COMMENTS service numberother --- I'm trying to put numberone after name-1 numbertwo after name-2 numberthree after name-3 numberfour after name-4 numberfive after name-5 numberother after name-other The problem is in name-4 and name-5 because there are on the same line. So this is my code but it doesn't work for name-4 and name-5. #!/usr/bin/perl open (IN,"data"); while () { $#a=0; $serv=""; $i=""; push (@a,/\s(nam\S+)/g); for $i(@a) { ($serv)=/(^serv\S+\s+\S+)/; print "name = $i\n"; print "service = $serv\n"; } } Thanks in advance for any solution. Cordially Ken