in reply to sorted Hash

You need numerical sort, try the following

for $key ( sort {$a<=>$b} keys %hash) { print "($key)->($hash{$key})\n"; }

In your way with foreach

foreach (sort { $a <=> $b } keys(%SRV) ) { print"$_: "."$SRV{$_}"; }
Update:

foreach code added


All is well. I learn by answering your questions...

Replies are listed 'Best First'.
Re^2: sorted Hash
by intoperl (Acolyte) on Aug 22, 2015 at 16:04 UTC

    Thanks Vinoth, that was quick and my silly thing resolved. Everyone is so awesome here..

      Do you understand why that worked? If not, have you looked it up in the documentation?

      The way forward always starts with a minimal test.