On 4/22/07, Ball, Donald A Jr (Library) <donald.ball / nashville.gov> wrote: > ... > def self.decipher(cipher) > CODES.each_pair do |letter, code| > prefix, suffix = cipher.split_at(code.length) > next unless prefix == code > if suffix == '' > yield letter.to_s > else > decipher(suffix) {|result| yield letter.to_s << result } > end > end > end > > end > > Morse.decipher(ARGV[0]) {|word| puts word} That's pretty much what I did (as well as some others) but yours is much more elegant. I didn't really think about using a block with the recursion. Cool.