ספר המדות Children / Part II · יט
Sefer HaMiddot 336
יט. מִי שֶׁאֵין לוֹ בֵּן זָכָר, יַרְגִּיל אֶת עַצְמוֹ לְהָבִיא מַתָּנוֹת לְתַלְמִידֵי־חֲכָמִים, וְיאמַר פָּרָשָׁה שֶׁל בִּכּוּרִים וְגַם יִלְמַד גְּמָרָא הַרְבֵּה וִימַעֵט בְּלִמּוּד אַגָּדָה, כִּי לִמּוּד אַגָּדָה הוּא מְסֻגָּל לְבָנוֹת.
19. One who does not have a son should accustom himself to bring gifts to Torah scholars, and say the section of Torah verses about the first-fruit offering. Also, he should increase his study of Talmud, and minimize his study of Aggadah, for studying Aggadah is a segulah for having girls.