From: Jeff Moore Date: 2009-06-07T07:43:53+09:00 Subject: Re: STDIN, OUT, ERR and $stdin, out, err - Differences? Terry Cooper wrote: > Can anyone explain what's happening here? > > print $stdin.fileno => 0 > print $stdout.fileno => 0 > print $sterr.fileno => 0 > > print STDIN.fileno => 0 > print STDOUT.fileno => 1 > print STDERR.fileno => 2 > > print STDOUT.object_id => 21673330 > print $stdout.object_id => 21673330 > > I get the same results in and out of eclipse and with irb > > ruby 1.8.6, XP > > Many thanks. Simply, STDIN, STDOUT, STDERR are CONSTANTS and $stdin, $stdout, and $stderr are global variables. They are the same initially but the variables can be re-assigned. -- Posted via http://www.ruby-forum.com/.