in reply to adding a count before the limit?

Just to clarify dragonchild's second suggestion: does this do what you need?

my $count = @five; print "$id,$accounts_by_id->{$id}{info},$count", join(',', @five), "\n";

the lowliest monk