Is it better for a person to have boys or girls?
On Daf 16b the gemora writes that a daughter was born to R. Shimon the son of Rebbi and he was despirited. His father said to him: Increase has come to the world. Bar Kappara said to him: Your father has given you empty consolation. The world cannot do without either males or females, but happy is he whose children are males, and alas for him whose children are females.
But what was the consolation that his father was giving him, and why did Bar Kappara say that it was empty consolation? The explanation is that really it is better for the world when a female is born rather than a male. This can be illustrated by examining a situation where there are ten males and a hundred females, and each male marries ten females. Now, if a further male is born, no new increase has come to the world except for this one extra male, because the males who were already in the world can already marry all the females, and so the world has no need for this new male to increase the population of the world. But if a female is born there would be increase in the world that was not here before since she is capable of having new offspring.
But for whom is this good? For the world! But for the father it is better when a son is born to him, because this one son can marry many women and the father can have offspring from each one, but if he has a daughter he can have offspring only from her.
According to this we now understand the consolation that his father was giving him when he said “increase has come to the world”. He was saying that for the world it is better that a daughter was born because a increase came to the world which was not there before. But Bar Kappara said to him that it was empty consolation because it was good only for the world, but for R. Shimon it would have been better if he had given birth to a son who could have married many women and thereby he could have had many offspring. Therefore, happy is he whose children are males.
Who needs to have their character traits healed?
On Daf 58b the gemora writes that R. Bena’ah saw an incorrect inscription written over the gateway of his city and commented that it should say “At the head of all sickness am I, blood; at the head of all medicine am I, wine”. The elders of the city therefore wrote “But the elders of the Jews say: At the head of all sickness am I, blood; at the head of all medicine am I, wine. Only when there is no wine is medicine required”.
The gemora can be explained as follows: The head of all sins is desire, and the blood, which is the soul, is the thing which does the desiring. Thus, “the head of all sickness” meaning "the beginning of the sickness of the soul" is the blood. And “the head of all medicine” to heal the soul is wine, and this alludes to the Torah which is compared to wine, as Chazal have taught in many places.
But “only when there is no wine is medicine required”. That is, someone who is not a master of the Torah requires healing of his character traits and needs to be taught how to conduct himself, because the Torah is called the medicine of life as Chazal taught in Kiddushin 30b. But one who is a master of the Torah does not need his character traits to be healed. He only needs to involve himself in learning Torah and fear of Heaven the whole day long.