my %hash = ('one' => 1, 'two' => 2, 'three' => 3, 'four-minus-one' => 3); my %newhash = reverse %hash; # %newhash now contains (1 => 'one', 2 => 'two', 3 => 'four-minus-one') # or # (1 => 'one', 2 => 'two', 3 => 'three')