close

 

有兩個陣列,每個都有兩欄(所以是 A1,B1 和 A2,B2),A 是座標,對映到一個 B 是 value,
請計算 B1 和 B2 之間的比例,如果他們相對映的A相同或相近。

#!/usr/bin/perl -w

my @data = qw( 1 3 );
my @data1 = qw( 2 10 );

$coor_diff_allow = 1;

if ( abs( $data[ 0 ] - $data1[ 0 ] ) <= $coor_diff_allow )
{
print "\nThe ratio of values is : ", $data[1]/$data1[1] ,"\n";
exit 1;
}
else
{
print "The coordination is not even close.\n";
exit 1;
}


來源:奇科電腦Ben老師  http://www.geego.com.tw

arrow
arrow
    全站熱搜

    台灣 富捷IT培訓 發表在 痞客邦 留言(0) 人氣()