with the code above, i see a few different methods:
- (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++ ;
}
- Check the split() to see that it got a 2-element array back.
- Subtract off the last value. (i don't like this method)
} # foreach
$additive_GU_value -= $value;
close (COM);
- 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.