Wagner,
Many thanks for the help.
It turned out that the problem is related to the input file, where each
line ends with both a \n and \r. It seems that chomp() has removed \n, but
\r is still there, so that the key and value etc are not integers.
I also noticed that if I read the file, and then
Zhenhai Duan wrote:
> Hi,
>
> I have a simple code but I just cannot get the correct result. Can
> anyone take a look at the code for me? Many thanks.
>
> print "\nOutput: AS -- Subnets\n";
> foreach $key (sort numerically (keys %subnets)) {
>print "key = $key", "\n";
>@subnet = split(/:/