Hello,

I am a beginner in perl. I am stuck with a problem. I have an array which looks like this

```
6.324 32.707 50.379
5.197 32.618 46.826
4.020 36.132 46.259
7.131 38.210 45.919
6.719 38.935 42.270
2.986 39.221 41.892
-0.269 37.184 41.565
```

`Inline Code Example Here`

These are the X, Y and Z coordinates from a pdb file. I want to calculate the distance using these three coordinate values. First i want to know how to assign variable names to these values in the array. I have to use this formula to calculate the distance:

$dist = sqrt(($x1-$x2)**2+($y1-$y2)**2+($z1-$z2)**2);

Till now I have written the script shown below to obtain the three columns which is shown above. I am stuck. I need help to calculate distance using 'for loop' or i guess its two for loops within which would look something like this:

```
for($AAi = 1; $AAi<= 7; $AAi++){ #here $AAi shud take the first three values(x1, y1, z1)
for ($AAj = 2; $AAj<= 7; $AAj++){ #similarly $AAj shud take 2nd 3 values(x2, y2, z2)
my $dist = sqrt(($x1-$x2)**2+($y1-$y2)**2+($z1-$z2)**2);
```

and do an iterative distance calculation. am stuck....

my exiting code:

```
open(IN, "/Users/anu/out.pl") or die "$!";
while (my $line = <IN>) {
chomp($line);
my @array = (split (/\s+/, $line))[6, 7, 8];
print "@array\n";
}
close(IN);
```

Thank you..