On Monday, June 06, 2011 11:40:25 AM Robert Klemme wrote:

> > And that's only one kind of default variable, and there are all sorts of
> > other variables Perl magically defines for you. Ruby's borrowed a few of
> > them, but they're all well-defined by now, and generally obviously
> > 'special' in some way, like __FILE__ and $1.
> 
> Ironically $_ is one of them. :-)
> 
> $ seq 1 5 | ruby19 -ne 'p $_'
> "1\n"
> "2\n"
> "3\n"
> "4\n"
> "5\n"

That doesn't seem to be the same thing, though. In Perl, $_ is the "default" 
variable -- anything you'd ordinarily do to a specific variable or expression 
can often have that variable/expression ommitted, in which case, it'll use $_, 
@_, or %_.

In Ruby, $_ is much narrower in scope -- a quick Google says, "The last input 
line of string by gets or readline." That puts it more in the same category as 
the regex matchers.

I'd probably still rather not have them, but I definitely don't see a good way 
to add more at this point. It'd be like trying to add a keyword.