unless ($seen{$comment_author2}){ $seen{$comment_author1} = $comment_author2; } else { delete $seen{$comment_author2}; }