SPUG: RE / Split Question

Orr, Chuck (NOC) chuck.orr at attws.com
Thu Jul 31 00:51:05 CDT 2003


Thank You all for the excellent responses.
 
I tried several of these because I felt guilty wasting all the thought
and code.  The solution that seems to fit my life best is the one from
Lee Wilson.  Lee, thanks a million.  If you're ever in the Bothell area,
I owe you a lunch.  I appreciate everyone's efforts on this one.  
 
Thank You,
Chuck Orr
chuck.orr at attws.com
425 501 8027

	-----Original Message-----
	From: Orr, Chuck (NOC) [mailto:chuck.orr at attws.com] 
	Sent: Wednesday, July 30, 2003 4:55 PM
	To: spug-list at mail.pm.org
	Subject: SPUG: RE / Split Question
	
	
	Hello All,
	 
	Please help with the following dilemma:
	
	     I am being given a glob of data from a web page that I need
to fix with perl.  It comes in as $blob looking like this:
	 
	425 501 sttlwa01t 425 712 sttlwa01t tacwa02t 425 337 tacwa02t
...
	 
	I need to break this up so the word characters associated with
the numbers stay with their numbers.  Ideally, I would have an array
like this:
	 
	425 501 sttlwa01t
	425 712 sttlwa01t tacwa02t
	425 337 tacwa02t
	 
	As you can see, I am not assured of the number of words that
will follow each set of numbers.  Could you please suggest a split or
some other tool that will turn the glob into the fix?
	$new_array = [ split /(?=[A-Z]\s\d)/,$scalar ];  

	Which is as close as we got, does not work.  It keeps the split
characters, but in a funky way that I cannot deal with.  It also will
always miss the last chunk of the glob.

	 
	Thanks,
	Chuck

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20030730/ee59be83/attachment.htm


More information about the spug-list mailing list