=begin
Hello,

I parse an array of symbols to output some program code. In reality I
map ALT, CTRL and SHIFT declarations to VK_KEYS in Java. But the
principle is the same. It is not a hash, a :symbol_* can appear more
than once.

The list of symbols and what it applies to (ie SHIFT + VK_HOME) is a
straight array that I slice() in pairs just before I use it. It is
declared right on top of the little program below.

I want to read in these ruby symbols from an external file
"zoo.txt",but I don't know how. Nor do I know how to write
file zoo.txt.

Can you help me with this?
=end

[
:symbol_1,:Zebra,
:symbol_1,:Tiger,
:symbol_2,:Pinquin,
:symbol_2,:Flamingo,
:symbol_3,:Black_Widow,
].
each_slice(2).each do|b|
case b[0]
when:symbol_0 then puts <<_

Symbol Zero: #{b[0]}-> #{b[1]}
_
when:symbol_1 then puts <<_

Symbol One: #{b[0]}-> #{b[1]}
_
when:symbol_2 then puts <<_

Symbol Two: #{b[0]}-> #{b[1]}
_
when:symbol_3 then puts <<_

Symbol Three: #{b[0]}-> #{b[1]}
_
end
end

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