Hi all damn thanks for the fast reply!!!
Happy to be a part of Perl Monks!
- Hi Jaap sorry about the code tag i will
remember it next time:)
yes sorry about $array this should be $file2.
just reference with the same name gives allot of problems
so every refferance maid to @file2 should be $array
i apologies for this but after testing so many times
i forgot to change it. o_O
----------Bin Should be writen like this (SORRY)-----------
sub bin_search {
my ($array, $word) = @_;
my ($low, $high) = ( 0, @$array - 1 );
while ( $low <= $high ) { # While the window is open
my $try = int( ($low+$high) /2 ); # Try the middle element
$low = $try+1, next if $array->[$try] lt $word; # Raise bottom
$high = $try-1, next if $array->[$try] gt $word; # Lower top
return $try; # We've found the word!
}
return;
}
THANKS AGAIN!
| [reply] [d/l] |