I can't tell by this code alone, but does the benchmark time the entire
script that's running, or just the iterate/sort part?
i.e. is the 'rand' function timed also, and will the time difference between
generating 20 and 10,000 numbers mess up the results?
Sorry I can't test this myself, I'm at a computer w/out perl :O !!
Cheers, Carl
Please don't cc me. I'm on the list.
>
> my @bob = rand for (1..20);
> my @joe = rand for (1..10_000);
> sub maxOne
> {
> my $max = (sort {$b<=>$a} @bob)[0]
> }
> sub maxTwo
> {
> my $max = (sort {$b<=>$a} @joe)[0]
> }
> sub maxThree
> {
> my $max = $bob[0];
> for (@bob)
> {
> $max = $_ if $_ > $max
> }
> }
> sub maxFour
> {
> my $max = $joe[0];
> for (@joe)
> {
> $max = $_ if $_ > $max
> }
> }
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]