what is "$:" in ruby?
It's just the way Array.inspect displays recursive arrays. The last Element of a is a itself. If a where displayed after 5, inspect would end up in an endless loop:
[1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [1, 2, 3, 4, 5, [...]]]]]