Firstly, there's lots of useful code dealing with this already on the monastery. Type sorting hash into the search box at the top of the page to find it.
The first potential problem is that your hash values can't contain the ; character. See perlfunc:split (specifically, its LIMIT argument) to find out why. Basically, unless you specify the number of fields split should return, it will create any array using every ; it finds as a delimeter.
Also, you're assigning the key to be the value at $callhash{$key} = $key. Are you sure you don't want $callhash{$key} = $value instead?
Finally, think about how scoping works. At the top of your code, you're declaring $key and $value to be empty strings. Then within your while loop you declare new variables, but they are only valid within the scope of that loop. So, when you try to print $value within your foreach loop, you're outputting the empty string you declared at the top of the code. Here, you probably want to remove $value.
Also, I assume you're using strict and warnings (or -w) earlier on in your code. Good luck!
Update: I need to learn to type faster. There weren't any replies when I started writing this!
In reply to Re: Hash sorting
by tomhukins
in thread Hash sorting
by jamen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |