Date: 18 Sep 2001 23:26:22 GMT From: damian@qimr.edu.au (Damian James) Subject: Re: split SuchKindOfWord into individual words Message-Id: On Tue, 18 Sep 2001 20:47:39 GMT, Chris Fedde said: >In article , >* Tong * wrote: >>Hi, >> >>I'm wondering if there are some neat ways to split SuchKindOfWord >>into individual words, i.e., Such Kind Of Word. >> >>Any tip will be appreciated. Thanks >> > >I'm sure that the golf pros can do better than this but here is my attempt: > >perl -e 'print "$1 "while("SuchKindOfWord"=~/([A-Z][[a-z]+)/g);print"\n"' perl -e '$i+=/[A-Z]/,$o[$i-1].=$_ for split//,"SuchKindOfWord";print"@o\n"' Longer, but can cope with slightly less strict data. Cheers, Damian -- @:=grep!(m!$/|#!..$|),split//,;@;=0..$#:;while($:=@;){$;=rand $:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,, $,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__ Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub