in reply to perl array matrix

It is not very clear to me. My guess is that you are trying to use an array of arrays, probably something like this:
( [1, 2, 3, 4,], [5, 6, 7, 8,], [9, 10, 11, 12,], [13, 14, 3, 16,], [2, 18, 19, 20,] )
but you'll have to explain why "2,7,12,16" and "2,4,7,12" should return true and why "1,6,8,12" and "1,5,14,15" should return false. Well, "1,5,14,15" being false, I can understand a plausible reason, because 15 is nowhere in the data structure, but why "1,6,8,12" should be false?

Je suis Charlie.

Replies are listed 'Best First'.
Re^2: perl array matrix
by Anonymous Monk on Apr 12, 2015 at 11:59 UTC
    Hi ; Je suis Charlie. : This is due to the "2,7,12,16" and "2,4,7,12" numbers are nearby each others . and the others are not. in term of matrix x and y position.

      Maybe it would help if you define the distance function for your matrix and tell us that function?

        it is something like word search puzzle games . but word search puzzle ONLY return horizontal,vertical + X direction . I need to see Y , Z , L or zigzag directional as well.