if(defined $hash{$key}) { $key = $key + .0000001 until !defined $hash{$key}; $hash{$key} = $value; } else { $hash{$key} = $value; }