"A ring of gold in the snout of a pig" (Proverbs 11:22) -- if you put any silver in the snout of a pig, it goes and dirties it in mud and dung, and if it does not rinse it off, it smears it. So too, if a disciple of the sages goes to a harlot and does his needs with her, he ruins his Torah; therefore it is said, "a ring of gold in the snout of a pig." "A beautiful woman who turns aside discernment" (Proverbs 11:22). Rabbi Alexandri said: that she turns Torah aside from him. But anyone who passes by the doorway of her house and does not lust after her beauty, the Holy One, blessed be He, calls him righteous, as it is said (Proverbs 11:23): "The desire of the righteous is only good, but the hope of the wicked is wrath" -- what is "wrath"? Rabbi Yochanan said: that the hope of the wicked passed away in that very transgression which he transgressed.
A Gold Ring in a Pig's Snout and the Scholar Who Strays
Midrash Mishlei 11:3
(משלי יא כב): "נזם זהב באף חזיר" - אם אתה נותן כל כסף באף חזיר, הוא הולך ומלכלכו בטיט ובצואה, ואם אינו מדיחו - מורח, כך, אם הולך תלמיד חכם אצל זונה ועושה צרכיו עמה, מקלקל תורתו, לכך נאמר: "נזם זהב באף חזיר". "אשה יפה וסרת טעם". אמר רבי אלכסנדרי: שמסירה תורה ממנו. אבל כל מי שעובר על פתח ביתה ואינו מתאוה ליפיה, הקב"ה קורא לו צדיק, שנאמר: (משלי יא כג): "תאוות צדיקים אך טוב, תקוות רשעים עברה" - מהו עברה? אמר רבי יוחנן: שעברה תקוותו של רשע באותה עבירה שעבר.