my @arr = (1 .. 1_000_000); my $x = 425983; printf "search for $x? found at position: %s\n", binarySearch(0,$x,\@arr);