"Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> D'oh ... just tested my assumption, it was wrong ... *sigh* okay, back
> to the drawing board on the code ...
Can't you just change
>> foreach $company_id ( keys %traffic ) {
to
>> foreach $company_id ( sort keys %traffic ) {
etc.
regards, tom lane