#!/usr/bin/perl -w

$NUM = 100;
$MAXINT = 50000;

srand(); 	# initialize the randomize seed 

print "Numbers Generated:\n(";
for my $i (1 .. $NUM) {
	push @array, sprintf("%d", rand(1) * $MAXINT); 
	print $array[$i-1]; 
	print ", " unless ($i == $NUM); 
} 
print ")\n\n";

print "Please enter the number to search for >> ";
chomp($toSearch = <STDIN>);

require "binarysearch_recursive.pl";
my $hit = Search::binarySearch(@array, $toSearch);

if ($hit) { 
	print "\n\"$toSearch\" found in array.\n";
} else {
	print "\n\"$toSearch\" not found in array.\n";
}
print "Number of comparisons: ", Search::getNumberOfComparisons(), "/", scalar(@array), "\n";
