I mentioned in the OP that I was still working on the code in order to get the output as I would like it to present. But here's the code in a proper format:
use strict;
use warnings;
my @points = ( {X=>79.620, Y=>54.720, Z=>53.034},
{X=>81.822, Y=>54.071, Z=>50.027},
{X=>83.871, Y=>51.966, Z=>52.424},
{X=>80.927, Y=>49.712, Z=>53.305},
{X=>80.565, Y=>46.114, Z=>52.104},
{X=>77.173, Y=>45.173, Z=>50.689},
{X=>75.652, Y=>41.722, Z=>51.009});
my @results;
for my $x(0..$#points){
my $p1 = $points[$x];
for my $y (0..$#points){
my $p2 = $points[$y];
my $dist = sqrt(abs(( $p1->{X} - $p2->{X} ) **2
+ ( $p1->{Y} - $p2->{Y} ) **2
+ ( $p1->{Z} - $p2->{Z} ) **2)) ;
$results[$x][$y] = sprintf("%.0f", $dist);
}
}
#-------------------
for my $r (@results){
printf "%.0f\t",$_ for @$r;
print "\n";
}
/code |