in reply to Re: I need to sort out some values and get only the highest generated by my perl script
in thread I need to sort out some values and get only the highest generated by my perl script

If all he is doing is printing the largest value, would not the following suffice?

program.pl|sort -n|tail -1

No extra coding needed, and it uses programs that already exist on the system.

  • Comment on Re^2: I need to sort out some values and get only the highest generated by my perl script
  • Download Code

Replies are listed 'Best First'.
Re^3: I need to sort out some values and get only the highest generated by my perl script
by Eimi Metamorphoumai (Deacon) on Oct 29, 2004 at 15:52 UTC
    If that's what's happening, yes. I read his message as "I have a loop that goes 1000 times, and each time it generates a bunch of data. I want the largest value produced from each run of the loop, ie, 1000 largest values," which wouldn't work from your model. Also, it's almost certain to be less efficient (O(n log n) instead of O(n) to do the sort, then throw away all the extra sort data that was just computed).