my $tmp = ($right+$left) / 2; if ($a[$tmp] > $search_for){ ...