"From Ephraim, their root" (Judges 5:14): this is Joshua, as it is said, "And Joshua weakened Amalek" (Exodus 17:13). He rooted his strike into Amalek, as it is said, "For I will utterly blot out the memory of Amalek" (Exodus 17:14). "After you, Benjamin" (Judges 5:14): this is Saul, of whom it says, "and put to death man and woman" (1 Samuel 15:3). And likewise Mordecai. The Holy One, blessed be He, said: it is foreseen and revealed before Me that he is destined to decree to destroy, to slay, and to annihilate all the Jews, young and old (Esther 3:13); therefore "put to death man and woman," to fulfill what is said, "and they shall eat of the fruit of their own way" (Proverbs 1:31).
Yalkut Shimoni on Nach 50:4
Yalkut Shimoni on Nach 50:4
מני אפרים זה יהושע. שנאמר ויחלש יהושע את עמלק. שרשם בעמלק כי מחה אמחה את זכר עמלק. אחריך בנימין זה שאול והמתה מאיש ועד אשה, וכן מרדכי אמר הקב"ה צפוי וגלויי לפני שהוא עתיד לגזור להשמיד להרוג ולאבד את כל היהודים מנער ועד זקן לפיכך והמתה מאיש ועד אשה לקיים מה שנאמר ויאכלו מפרי דרכם: