in reply to Lost contents of arrays...

I don't think that local $/ = /^\s+$/; is not doing what you think it is. According to perlvar:

Remember: the value of $/ is a string, not a regex. awk has to be better for something. :-)

That said, you can switch:

print SUM2 foreach @sorted_recs;
to something like:
foreach my $array_ref( @sorted_recs ) { print SUM2 foreach ( @$array_ref }; }
to dereference the array (take a look at perlref, and at tye's References quick reference for more info)

-enlil