Nengbing Tao wrote:
> -90 8765 8675
> 90 1234 1324
> -198 4765 4567
>
> Notice that |1500-1485|=|1500-1515|.
>
how can you have negative if they are abs? anyway, have you try:
#!/usr/bin/perl -w
use strict;
my @xa=(8765,6000,4765,3000,1530,1500,1465,1234,1000);
my @xb=(8675,6000,4567,3100,3000,1545,1515,1485,1324,1005);
my %hash;
for my $i (@xa){for my $j (@xb){push(@{$hash{abs($i-$j)}},"$i\t$j")}};
for my $diff (sort {$a <=> $b} keys %hash){
print "$diff\t$_\n" for(@{$hash{$diff}});
}
__END__
prints:
0 6000 6000
0 3000 3000
5 1000 1005
15 1530 1545
15 1530 1515
15 1500 1515
15 1500 1485
20 1465 1485
45 1530 1485
45 1500 1545
50 1465 1515
80 1465 1545
... etc
not sure if that's what you want...
david
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]