in reply to Subroutine not correct (I think)

use List::Util qw( sum ); use List::MoreUtils qw( pairwise ); sub distance { my( $aa, $bb ) = @_; $aa == $bb and return 0; # optimiz. @$aa == @$bb or die "coordinate vectors unequal length!"; sqrt sum pairwise { ( $a - $b ) ** 2 } @$aa, @$bb }