Larme wrote:
> I have to write the code as
>
> result = data.sort {|x, y| x[col].to_i <=> y[col].to_i }
>
> to let the script run properly. I'm quite confused here. I think the
> elements of array data are converted to integer when the code
>
>   data[counter].map! {|str| str.to_i}
>
> finished. However why ruby still requires a explicit conversion when I
> use the data.sort?

If you have an array arr with n elements which you all turn into integers,
arr[i] with i>=n will still be nil. So if in your case not all rows have more
than col columns, that would explain the problem.


HTH,
Sebastian Hungerecker
-- 
NP: Kataklysm - Where the Enemy Sleeps...
Ist so, weil ist so
Bleibt so, weil war so