From: Marco Guiseppe Date: 2007-02-09T02:37:16+09:00 Subject: Newbie problem with modifying array correctly Hello, I have an array with subarrays containing integers, and want to make sure that the distance between any two numbers next to each other is equal to or less than 7, also from one subarray to the next. Rigth now I have two blocks to do this, one to check each element of a subarray against the previous element, and one to check the last element of a subarray against the first element in the next subarray. The problem is that whichever block comes last mess up the work done by the first block. Here is an example with an array that is similar to the one my program will generate: http://pastie.caboo.se/38816 Here is a smaller example to make it easier to understand: http://pastie.caboo.se/38822 If you're not familiar with Pastie, you can click "View" on the right to see a wrapped version (at least in Safari). Any help is much appreciated! PS. Using flatten is really not an option (as far as my newbie eyes can see) because when modifying a "bad" integer I can't just choose any number, but need a number from the corresponding skala_rekke-subarray (sorry about the norwegian variable-name). :-) -- Posted via http://www.ruby-forum.com/.