From: "Jan E." Date: 2012-10-05T01:09:33+09:00 Subject: Re: Extract numbers from an alpha numeric string Hi, when you iterate over single characters, then of course you only get numbers with one digit. And when you remove the separators, you also make the numbers indistinguishable. For example, "2-2" has the same output as "22". So this cannot work. You either have to split the string at the "-" or look for numbers with a regex: input = '1-3-11-7-4-7' players = input.split('-').map {|num| h[num.to_i]} p players or input = '1-3-11-7-4-7' players = input.scan(/\d+/).map {|num| h[num.to_i]} p players I didn't exactly understand what you want, so this is just an array of the selected values of the "h" hash. -- Posted via http://www.ruby-forum.com/.