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


in reply to (tye)Re: getting my neighbours in an N-dimensional space
in thread getting my neighbours in an N-dimensional space

Oh well done! This is exactly what I was waffling on about. Except that as it stands, your code returns the point of origin, and the origin can't be a neighbour of itself.

--
g r i n d e r
print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u';