Help for this page
print "difference is " . $array[$counter] - $array[$counter - 1];
print "difference is " . $array[$#array] - $array[-2] , "\n";