From: ts Date: 2001-06-09T18:19:11+09:00 Subject: [ruby-talk:16349] Re: Tcl string map lookalike >>>>> "Y" == YANAGAWA Kazuhisa writes: Y> map = {"<" => "<", ">" => ">", "<" => "<", ">" => ">"} Y> p str.gsub(/#{map.keys.join("|")}/) { map[$&] } You can't do this. If tcl use an array (and not an hash) this is because you can't predict the order of the keys in an hash. With set map [list "<" "<" "<" ">" "<" "<" ">" ">"] the substitution for "<" is always tested before "<" And for tcl "str map" don't use a regexp, this mean that you must call Regexp#quote when you build the regexp. Guy Decoux