From: Ne Scripter Date: 2009-10-12T19:14:57+09:00 Subject: Spliting hash using map! Hello, I have a program which goes through a number of entries, a typical example of these entries is as follows: qwerty 0001 abcdef 0002 0003 0004 uvwxyz 0005 0006 Basically, the first string can match to one or more unique numbers. This structure is a hash. Later in my code I remove the string leaving only the numbers, I then wish to break the numbers down into their individual items, I use map! (output = ID.map!{|str| str.split(/\s+/) }.flatten!) to do this giving 0001 000200030004 00050006 What I want to do at this stage is have them broken into individual items instead of a full string for each, the purpose of this is so I can do something like this: if 0001.match(/#{output}/) puts output end So in a loop for the second entry we would be doing if 0001.match(/#{0002}/)..... if 0001.match(/#{0003}/) and so on At this stage I am not getting that result because I do not have 0002, 0003 and so on, I only have individual entries from the hash such as 0001. Could anyone assist me with this query? Sorry if it is unclear, and may thanks for your help. -- Posted via http://www.ruby-forum.com/.