# here's the hash %s = ( "substring1" => 'string1', "substring2" => 'string2', "substring3" => 'string3' ); # get the current keys @keys = keys(%s); # go through each key and sway the key/value foreach $key (@keys) { $s{$key} = $key; # print out the swapped hash value print "$s{$key}\n"; } Output ---------------------------------- substring1 substring2 substring3