I have two arrays, representing start and stop positions for a sequence,
@a=(1,15,30,50,65)
@b=(5,20,37,55,77)
so for example, the first elements of each array (1 and 5) represent the numbers 1,2,3,4,5; the two arrays define the numbers 1,2,3,..5,15,16,..,20,...,65,66,...,77)
Now, I also have two scalars, say, $s1=9, $s2=35, where these also represent a range of integers 9,10,11,..,35. The problem is to find the numbers defined by @a and @b which intersect with the range defined by $s1 and $s2.
I tend to things the long way in perl, so I thought of creating an array of arrays
@AoA=([1,5],[15,20],...,[65,77]) <p>
then finding the intersection of ($s1..$s2) with each of the array elements.
If anybody can think of a better way to do this, any help much appreciated, otherwise, a good way to create the array of array would also be appreciated.
Thanks in advance!