Hi,

In message "[ruby-talk:00610] How to trick the `$_' scope?"
    on 99/08/10, clemens.hintze / alcatel.de <clemens.hintze / alcatel.de> writes:

|the manual says, that `$_' is locally scoped. But now, I want to change
|that variable in a subroutine. I would like to propagate that change up
|to the caller.
|
|Why? I currently implement the `IO#each' method for `StringIO'. As
|`IO#each' would assign its read line to `$_' I have to do the same.
|
|Any way?

Hmmm, currently there's no way to change $_ in outer scope except
implementing a method with C.  With C, you can change it by calling
rb_lastline_set().
                                                        matz.