A simile is a description of something which involves its comparison with another thing to show similarity between them. Similes mostly make use of the words 'like' or/and 'as' to compare two things.
Here in this given excerpt from Act II of Hamlet, there are lines that are acting similes:
4. Must, like a who*e, unpack my heart with words,
In this above sentence, 'like a who*e' shows that it is a simile.
5. And fall a-cursing, like a very drab,
Here, 'like a very drab' indicates that is a simile.