Your code is fine.
Another way is to use a hash slice, using values to get the keys and keys to get the values.
Yet another way is to assign one hash to the other while using reverse.
All of these methods assumes the values are unique.
Update: Added last solution.
In reply to Re: Question about fast switch hash key-value pairs.
by ikegami
in thread Question about fast switch hash key-value pairs.
by lihao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |