the line
p *1..10
does exactly the same thing as
(1..10).each { |x| puts x }
which gives you the following output:
$ ruby -e "p *1..10"
1
2
3
4
5
6
7
8
9
10
it's a great shortcut when working with textmate for example, but what does the asterisk do? how does that work? couldn't find anything on the net...
It's the splat operator. You'll often see it used to split an array into parameters to a function.
More commonly it is used to accept an arbitrary number of arguments
It also works for multiple assignment (although both of these statements will work without the splat):
For your example, these two would be equivalent: