Andreas Lundgren wrote in post #1000859:
>> --output:--
>> "x1.to_s, x2.to_s, x3.to_s, x4.to_s"
>>
>> Also, compare that output to the output your loop produces:
>>
>>  "x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s"
>>
>> You would get many errors using that string as an argument list for a
>> method.
>
> I need this since parameters to win32ole are sent as a string with a
> comma separated list of arguments. That is to send in x1=1, x2='A' and
> x3=1.5 I do the call:
> handle.call(['MethodNameIn','Params'],['x1, x2, x3', '1, A, 1.5']);
>

If you need to send the string 'x1, x2, x3', then you need to create 
that string, not this garbage:

"x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s"


Do you not see the difference between these two strings:

"x1, x2, x3"
"x1.to_s + ', ' + x2.to_s + ', ' + x3.to_s + ', ' + x4.to_s"


Do you not see that those strings have different lengths?  You seem to 
think that ruby is going to do some type of eval on the second string 
and you will end up with the first string, but ruby is not going to do 
that.  The second string above is a *string*, it is not an *expression*.

-- 
Posted via http://www.ruby-forum.com/.