efficient max() function from sort

[email protected] (Ramprasad A Padmanabhan)
Newsgroups perl.beginners
Message-ID <[email protected]>
I use sort to give the max of an array something like this 

-----
my @z = qw(12 24 67 89 77 91 44 5 10);
my $max = ((reverse sort{$a <=> $b} (@z))[0]);
print "MAX = $max\n";
-----------

but when I am interested only in a single max value, I need not sort the 
entire array 
Is there a more efficient alternative to this

PS: Posts via nntp to nntp.perl.org  appear after a long time
Is there a more preferred way of posting here 


Thanks
Ram
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.