From: email55555@... Date: 2005-09-22T23:41:39+09:00 Subject: Re: Parsing one-liners If your numbers are *true* floats (for example 123.0 instead of 123), then you could try this: w = eval("[#{input_string}]") Kevin Olbrich wrote: > The problem: > read in a string containing an arbitrary number of comma separated > numbers and convert it to an array of numbers. > > It seems like this could be a one-liner, but the best I can get is two... > > w=input_string.split(/,\s*/) > w.each_index {|n| w[n]=w[n].to_f} > > Anyone know a one-liner for this? > > _Kevin