in reply to need help to fix "use of uninitialized value..."

When you run $PairsOf{$Person1}        = $PairsOf{$Person1} . " " . $Person2;, then the second occurence of $PairsOf{$Person1} isn't defined yet, which is why you get the warning.

I'm not sure what you want to achieve, so I can't help you to fix it.