Special variable

A feature originally found in Perl, the special variables have special meanings to Ruby. These variables begin with a $ character and consequently are always global, in contrast to Perl which can make them local for certain purposes. (Variables relating to regular expression matching are locally scoped.) Most are named with $ followed by one or more non-alphanumeric characters.

List of special variables
The special variables in Ruby 1.8 are listed below, and grouped into categories of related variables.

Regular expression matching
These variables are locally scoped in spite of their initial $ character.

New in Ruby 1.9
The,  , and   variables, deprecated in Ruby 1.8, disappear altogether in Ruby 1.9. Setting  will provoke a warning and have no other effect.

and  are not tagged as deprecated in Ruby 1.8, but nonetheless provoke a warning if used in Ruby 1.9, and have no effect. s can now be tagged individually with their encodings.

The  variable reflects the warning level of 0, 1, or 2, which may be set on the command line or by assigning.