On Sun, Apr 13, 2008 at 10:17 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
>
> Nelson Castillo wrote:
(cut)
> That won't work correctly unless the numbers are sorted correctly:
>
> $ perl -le' print for sort { $a cmp $b } 0, 2, 3, 11, 12'
> 0
> 11
> 12
> 2
> 3
Hi. I wanted to stress that wi
Nelson Castillo wrote:
On Sun, Apr 13, 2008 at 3:10 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
(cut)
my $c = &$cmpf($arr->[$mid], $value);
That is usually written as:
my $c = $cmpf->($arr->[$mid], $value);
Thanks Chas. and John for your feedback. I think I'm happy with this ve
On Sun, Apr 13, 2008 at 3:10 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
(cut)
> >my $c = &$cmpf($arr->[$mid], $value);
> >
>
> That is usually written as:
>
>
> my $c = $cmpf->($arr->[$mid], $value);
Thanks Chas. and John for your feedback. I think I'm happy with this version:
#!/us
Nelson Castillo wrote:
Hi :-)
Hello,
I wrote this binary search function. I wrote it so that I could pass
a comparison function as the last parameter. But I have to write
"sub" and I noticed that the built in sort function doesn't need it.
So I have to write:
sub { shift <=> shift}
instead
On Sun, Apr 13, 2008 at 2:38 PM, Nelson Castillo <[EMAIL PROTECTED]> wrote:
> Hi :-)
>
> I wrote this binary search function. I wrote it so that I could pass
> a comparison function as the last parameter. But I have to write
> "sub" and I noticed that the built in sort function doesn't need it.
Hi :-)
I wrote this binary search function. I wrote it so that I could pass
a comparison function as the last parameter. But I have to write
"sub" and I noticed that the built in sort function doesn't need it.
So I have to write:
sub { shift <=> shift}
instead of:
{$a <=> b}.
This might be a