Array question

Hello,

I have a function like this:

def f(*args)
#do something
end

and I have an array, say

a = [1,2,3]

Now I would like to call f() with the contents of the array i.e.

f(1,2,3) in this case (i.e. not f([1,2,3]) )

What is the most Rubyish way to accomplish this?

TIA,
Peter

On 11/10/06, Peter S. [email protected] wrote:

and I have an array, say
Peter

Splat the array first with the * (splat) operator.
f(*a)

On 09/11/06, Peter S. [email protected] wrote:


http://www.rubyrailways.com

f(*a)

Farrel