http://www.perlmonks.org?node_id=1123184

perlhelp has asked for the wisdom of the Perl Monks concerning the following question:

can somebody show me the example perl code for array matrix related question .

1.Hash of Number to Array of Position.

2.Hash of Position to (Hash of Number to Array of Position). Thanks

here is the example from the blog.

I have a matrix

note: the matrix can be number or string.

( 1, 2, 3, 4,

5, 6, 7, 8,

9, 10, 11, 12,

13, 14, 3, 16,

2, 18, 19, 20)

and a search string. The task is to find out whether the numbers in the search

string are values in the matrix that are near-by each other along the x and y

coordinates.

"2,7,12,16" should return true

"2,4,7,12" should return true

"1,6,8,12" should return false

"1,5,14,15" should return false