The rat or rodent motif is working on both the literal and figurative levels in the play Hamlet. In Act IV Scene I, Claudius is asking the Queen about Hamlet’s mental status. Reporting that Hamlet is crazy, she gives as evidence his killing of Polonius in Act III. Essentially the Queen is quoting Hamlet when she says that he “Whips out his rapier, cries, a rat, rat!” (IV [i] 10) The moment before stabbing Polonius, Hamlet says “How, now? A rat? Dead for a ducat, dead!” (III [iv] 28) No doubt, Hamlet could mistake the noise behind the curtain in his mother’s room for the scurrying of a rat.
But Hamlet also has in mind the words of his father’s ghost accusing his mother of adultery. “lust…will sate itself in a celestial bed/ and prey on garbage.” (I [v] 63-64) In this sense then, Claudius the rat feeds on the garbage the Queen has become by sleeping with her dead husband's brother. The play is filled with sexual innuendo.