Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: largest number inside array/hash

by Anonymous Monk
on Aug 17, 2012 at 17:09 UTC ( #988032=note: print w/ replies, xml ) Need Help??


in reply to Re: largest number inside array/hash
in thread largest number inside array/hash

Hi Nice elegant solution. but i guess this would work too

#!/usr/bin/perl -w use strict; my @array = ( 33, 56, 3, 2, 67, 101, 218, 4, 17 ); my @nums = sort { $b <=> $a } @array; print "The largest number is: $nums[0]\n";


Comment on Re^2: largest number inside array/hash
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://988032]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-07-05 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls