I've been searching for the past hour or so, including manually stepping
through the ruby parser code, trying to work out what the $- magic
global is or does.

I've gotten as far as the following:

ruby 2.1.0dev (2013-04-24 trunk 40429) [x86_64-linux]

irb(main):001:0> $-
irb(main):002:0> $-.inspect
=> "nil"
irb(main):003:0> a = $-
irb(main):004:0> a
=> nil
irb(main):005:0> $- = 42
=> 42
irb(main):006:0> b = $-
irb(main):007:0> b
=> 42

So it appears to be suppressing output in irb, in some strange way.  I
also note the following behaviour:

irb(main):001:0> $-
irb(main):002:0>
=> nil
irb(main):003:0> $- = 42
=> 42
irb(main):004:0> $-
irb(main):005:0>
=> 42
irb(main):006:0> $-
irb(main):007:0> :a
=> :a

It appears that the value of $- isn't returned until I hit enter a
second time, but only if there's no intervening value (whitespace is
ignored).

What's going on?!

Also note: it's impossible to search on Google for "$-" because Google
is a jerk

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