> In your case its pretty simple. The buffer is being reused. So > same memory being added multiple times to the candidate. > Just slap on a .dup when adding it. >> candidate ~= line; Thanks a lot replacing the line above with candidate ~= [line[0].dup, line[1].dup]; My problem is solved .