I'm having a little trouble understanding something. Save the following 
script in an empty directory and run it:

Dir.new(".").to_a.each do |x|
    puts "x=#{x}"
    puts "x.class=#{x.class}"
    puts "x[0]=#{x[0]}"
    puts
end

You should get output that looks something like this:

x=.
x.class=String
x[0]=46

x=..
x.class=String
x[0]=46

x=listdir.rb
x.class=String
x[0]=108

I was expecting x[0] to be a one-character string.

1) Why isn't x[0] a one-character string?
2) How do I determine what the first character of such a string is? I'm 
guessing this isn't the proper way, but I'd like to understand why it 
doesn't work.

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