$Mam = 'Mammal.txt'; open(FILE, $Mam) or die "Error. Could not open '$Mam'."; while() { chomp; @Loc = split(/\t/, $_); my $Dist; $Dist = CalculateDistance(54.988056, -1.619444, $Loc[1], $Loc[2]); #### while($Dist < 10) { $counter++; print "$counter animals are found withing 10KM\n" }