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(/:/, $subnets{$key}); for ($i = 0; $i <= $#subnet; $i++) { print$subnet[$i], "\n"; } }
foreach $key ( sort numerically ( keys %subnets)) { printf outfile "%d\t->\t%s\n", $key, $subnets{$key}; }
THe output on STDOUT is:
Output: AS -- Subnets key = 1 1 4 key = 4 4 1 key = 80 80
ANd it is correct. However the results in the output file (outfile) is:
:4 -> 1 :1 -> 4 80 -> 80
Actually I would expect:
1 -> 1:4 4 -> 4:1 80: -> 80
(I am using Net::Netmask module, and the perl version is:
This is perl, v5.8.3 built for i386-linux-thread-multi
) Many thanks for the help, -Zhenhai
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>