require 'optparse'
require 'ostruct'

arr = [1, 2, 3]
arr.logfile = "my_file.txt"

--output:--
 undefined method `logfile=' for [1, 2, 3]:Array (NoMethodError)


options = OpenStruct.new
options.logfile = "my_file.txt"
puts options.logfile

--output:--
my_file.txt


The lesson: identical variable names that appear in different scopes are 
not the same variable.

-- 
Posted via http://www.ruby-forum.com/.