From them names I guesstimate he populates this table from the SNMP interface MIB. The index of the ifTable is not necessarily contiguous. Some devices give you 1,2,3.. then jump to 100 or even 1000. So that is not practical as array index. I had the same problem and solved it with hashes plus a custom sort function:
sub sort_by_intf # sort interface alpha/number name mixture properly
{ my $A = $a; # just turn any number into a 0004 digit one
my $B = $b;
$A =~ s/([0-9]+)/ sprintf "%04d",9999-$1 /ge;
$B =~ s/([0-9]+)/ sprintf "%04d",9999-$1 /ge;
$B cmp $A; # reverse order happens to be useful here:
} # Tun0, Ser1, Port-channel2, Gi3, Fa4, Eth5
Then whenever you loop over the keys, just sort them with that function like so:
for (sort sort_by_intf keys %ifSpeed) {
printf "intf: %s, speed: %d\n" $_, $ifSpeed{$_};
}