rakshas has asked for the
wisdom of the Perl Monks concerning the following question:

Hi,

I have written a binary search program. It runs fine, and I want to see the Bench marking on it. Below is the code. I am sending the an array an the value to the binarysearch function
which is supposed to calculate the search. However, the values are not going to the function. Please advice me

You have a scope issue. You can see this if you change your array declaration from my @binarysearcharray=... to our @binarysearcharray=.... The eval for the benchmark occurs in Benchmark package, and variables declared with my are not visible outside your current scope, in contrast to our. For a little more description of scope, see Private Variables via my().

Please note that if you include output in a benchmarking run, the i/o is likely to invalidate your conclusions.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.