in reply to while question

with the code above, i see a few different methods:
  1. (My preferred method) Match not just on the line starting w/a number, but also having a pipe:
    if( /^(\d+\.\d+)\|/ ){ $additive_GU_value += $1; $num_GU_processed++ ; }
  2. Check the split() to see that it got a 2-element array back.
  3. Subtract off the last value. (i don't like this method)
    } # foreach $additive_GU_value -= $value; close (COM);
  4. Push the first column to an array, and at the end pop the last item before looping through and summing. This innately stores the num_GU_processed, too.

Replies are listed 'Best First'.
Re^2: while question
by Anonymous Monk on Jun 02, 2005 at 15:00 UTC
    thanks for the thoughts i extended the if loop and that seems to work fine cheers