in reply to Best way to store/sum multiple-field records?

use warnings; use strict; my %data; while (<DATA>) { chomp; my ($id, $sum, $reason) = split /\|/; $data{$id}{sum} += $sum; $data{$id}{reason} = $reason; } use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper(\%data); __DATA__ USERID1|2215|Jones,Tom| USERID1|1000|Jones, Tom| USERID3|1495|Dole, Bob| USERID2|2500|Francis, Pope| USERID2|1500|Francis, Pope|