in reply to combining values from multiple lines

Please see How (Not) To Ask A Question; in particular, it's challenging to debug a parsing script without input data.

In a more general sense, if you use a hash keyed on account number, you can just use that value as an accumulator, i.e.

my %values_hash = (); while (<inData>) { chomp; # parse lines $values_hash{$ACTNUM} += $value; }

or something like that...