Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Find highest value

by nemesdani (Friar)
on Sep 19, 2012 at 14:10 UTC ( #994463=note: print w/replies, xml ) Need Help??


in reply to Find highest value

Consider:
  • read a line into an array
  • split it by whitespace
  • make a slice from the totals (the 5th, 7th, etc. element)
  • select the maximum with e.g. List::Util, use a flag is more maxes are found
  • write out the elements you need


  • Optionally the last 3 steps can be implemented in a subroutine, thus making your code more readable.


    I'm too lazy to be proud of being impatient.

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://994463]
    help
    Chatterbox?
    [1nickt]: That's good! I suppose the cpanfile would be the same however the app distro is structured ...
    [1nickt]: hippo no reason why not other than wanting to check an assumption :-)
    [hippo]: For a self-contained application which can therefore ensure thread safety it seems like a sensible approach.
    [choroba]: No, if there are no threads, then the user wants to use MCE. If there are threads, the user can choose.
    [1nickt]: choroba Understood. I'm wondering about the logic in a cpanfile. If the perl doesn't support threads, it's easy: require MCE. If the perl does support threads, as you say the user has a choice, so require both? Or, assume that irrespective of the choide

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (13)
    As of 2017-10-18 13:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My fridge is mostly full of:

















      Results (244 votes). Check out past polls.

      Notices?