in reply to Sum fields in Array

Should I reset the variables after it loops through to the next record? If so, how?

It's not clear what you're really trying to acomplish, but I don't see anything being summed. Perhaps you could provide some sample input and expected output.

As far as clearing variables, you should declare them inside the while loop so they are in the smallest scope possible. Declaring the variables at the beginning like you have done essentially makes them all globals.

my @fields; while (my $pimrpt = <PM>) { my ($systime,$company, $company_prev, ... ); ... etc

Replies are listed 'Best First'.
Re^2: Sum fields in Array
by drodinthe559 (Monk) on Feb 04, 2010 at 22:32 UTC
    Good suggestion...I've done that. I am going through a report and pulling various values. My question is when I have is when I hit another group of values that I need to pull from. Should I clear the previous set first by assigning the variables to null. Also should I push the variables into array or wait till have all the variables set and then push them into an array.