From: Gennady Date: 2004-01-31T06:13:41+09:00 Subject: Re: principle of most suprise tony summerfelt wrote: > gah, ruby is doing it to me again: > > logline=String.new("+ 30 Jan 12:20:09 [3988] addr: x.x.x.x") > tda=Array[(logline.split(/\[\d+\]/))] > tda.first tda.first.first should work here. split() returns an array, and you pack it into another array. To fix your code, do: tda = logline.split(/\[\d+\]/) tda.first > > is it too much to assume that the string is split using [xxxx] as a demliter > and that tda.first should return "+ 30 Jan 12:20:09"? > > i'm getting: + 30 Jan 12:20:09 addr: x.x.x.x > > i seem to be getting hung up on the simplest things. i'm using > 'ruby in a nutshell' and 'programming ruby' as my references. > >