in reply to accessing values from multidimensional arrays

Try this
my $coords = join ',', @{ $coords[$goal] };
That dereferences the array stored in the element at $goal in @coords. See. perlreftut and tye's References quick reference for further help.
HTH

_________
broquaint