I'm new to ruby, so forgive any obvious stupididity, but can anyone 
enlighten me as to why this...

#!/usr/bin/ruby -w

File.open("output","w") { |f|
   puts("To the screen")
   sso = $stdout
   $stdout=f
   puts("To the file")
   $stdout = sso
   puts("To the screen again")
}

does this...

root@bob rubyx # ./test
To the screen
root@bob rubyx # cat output
To the file
To the screen again


Thanks!

Andrew Walrond