>>>>> "Robert" == Robert Graham <[EMAIL PROTECTED]> writes:

Robert> I see what you mean
Robert> I assume the following would be a better way of going at it

Robert> $max = $min = $data[0];
Robert> foreach $val (@data) {
Robert>     $min = $val<$min ? $val:$min;
Robert>     $max = $val>$max ? $val:$max;
Robert> }

But read the rest of the thread.  For small and medium-sized data, the
built-in sort beats this code, as counter-intuitive as that seems.
There's probably some threshold at which the linear scan method burns
less CPU than a sort, but not for reasonable data. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to