From: Robert Klemme Date: 2004-02-09T10:33:23+09:00 Subject: Re: principle of most suprise "tony summerfelt" schrieb im Newsbeitrag news:NbeTb.1048$_62.314@read1.cgocable.net... > On Fri, 30 Jan 2004 at 21:24 GMT, Maik Schmidt wrote: > > > split will always return an Array (see "Ruby in a nutshell, p. 54). > > i read that a number of times before i posted...that's why i was stumped > > > You do not have to force this explicitly by using the Array constructor. > > i don't know what i was thinking...you'd never know it, but i'm a better > programmer than that :/ > > > And if you want to do so, you have to use '()' not '[]' :-)) > > i want to thank everyone for the polite replies :) it must have been hard > restraining yourselves :) Just to keep improving: change logline=String.new("+ 30 Jan 12:20:09 [3988] addr: x.x.x.x") to logline="+ 30 Jan 12:20:09 [3988] addr: x.x.x.x" which saves you a superfluous object creation. :-) To make results look a bit nicer you could also do result = logline.split(/\s*\[\d+\]\s*/).first to make the regexp eat up all white space that surrounds your split mark. Regards robert