use strict; use warnings; my %hash = (x => 1, y => 2, z => 3); my %rhash; @rhash{values %hash} = keys %hash; print $rhash{1};