Possible duplicate:Understanding the ruby symbol in ranges and arrays
can someone tell me what * is doing in the following code snippet?
line = "name=yabbi;language=ruby;" Hash[*line.split(/=|;/)]
Thanks.
* is the splat operator. It is used to split the array into a list of arguments.
*
line.split(/=|;/) returns an array. To create a hash, each element of the array must be passed as a separate parameter.
line.split(/=|;/)
This is a splat statement . Read about it. Often you see that it is used when you want to split the array into use as function parameters.