For what purpose are there $deferr, $defout and why there is no $defin if there are $stderr, $stdout and $stdin, and also STDIN, STDOUT and STDERR
Changing any of them will not change others
For what purpose are there $deferr, $defout and why there is no $defin if there are $stderr, $stdout and $stdin, and also STDIN, STDOUT and STDERR
Changing any of them will not change others
STDIN, STDOUT and STDERR are global stream constants (i.e. default values).
$stdin, $stdout and $stderr are global variables initialised to the value of the stream constants. This allows you to change their values at runtime (e.g. to change stdout to an alternative output device).
$defout is a way of creating an 'in-place' output stream. There is a brief discussion on the ruby mailing list here:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67822
Obviously you can't have an in-place input stream, so there is no '$defin'.
However, this is mostly for historical interest; I believe $defout and $deferr were deprecated some time ago with the release of Ruby 1.8.2, and current best practice is to use only $stdin, $stdout and $stderr.