Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: getting the highest value in a simpler way

by cfreak (Chaplain)
on Nov 10, 2004 at 15:29 UTC ( [id://406690]=note: print w/replies, xml ) Need Help??


in reply to getting the highest value in a simpler way

Why all the extra modules stuff? Just sort the array and grab the first or last one depending on how you sorted it.

This should do everything you want:

@array = sort { $b <=> $a } @array; printf("%03d",shift @array);

Update This way is simple but of course as sporty said, it takes longer

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-18 22:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found