"Guy N. Hurst" <gnhurst / hurstlinks.com> writes: > Hi, > > I have tried this: > > def foo(x=$_) > puts x > end > > $_ = "bar" > foo($_) # => bar > foo # => nil > print # => bar > > Why is it that the #print method is allowed > to have access to $_ as its default, but methods > we write aren't? Or is there something I am missing? Guy: If you want the 'global' $_, you can always do: def foo(x=eval("$_", TOPLEVEL_BINDING)) puts x end However, this won't always emulate the behavior of (say) print. Dave