schneik / us.ibm.com writes:

>           String comparison. If the value of the variable $= is not false,
> comparison done by case-insensitive.
> ============================================
> 
> I just want to be sure that this is the same as saying "If the value ... is
> not nil, ....".

Not quite. falsity (?) is 'nil' or 'false' (or the deprecated
'FALSE').

The interpreter normaly checks for 'truth' using the RTEST macro,
which returns the C equivalent of TRUE for every value apart from nil
and false/FALSE.

> It might be nice to have standard but automagically localized
> versions of these variables, perhaps $$=, $$/, $$\, and so on, that
> would locally over-ride their global counterparts.  Perhaps then
> Ruby strict compile mode could prohibit you from changing the global
> control variables, but allow the use of the localized control
> variables.

We could use 'local($/)'  ;-)


As a temporary hack, I guess you could define a class which pushed and 
popped values, and protect code that changes them in a
begin/ensure/end block.

  begin
    saver = Saver.new(:$/, :$\)
    # ..
    # .. stuff
  ensure
    saver.pop
  end

But that's pretty messy.


Dave