HAMLET:
Alas, poor Yorick! I knew him, Horatio: a fellow of infinite jest, of most excellent fancy: he hath
borne me on his back a thousand times; and now, how
abhorred in my imagination it is! my gorge rims at
it. Here hung those lips that I have kissed I know
not how oft. Where be your gibes now? your
gambols? your songs? your flashes of merriment,
that were wont to set the table on a roar? Not one
now, to mock your own grinning? quite chap-fallen?
Now get you to my lady's chamber, and tell her, let
her paint an inch thick, to this favour she must
come; make her laugh at that. Prithee, Horatio, tell
me one thing.
The dialogue that Hamlet makes about Yorick is very intricate and complicated to understand. However, his mention of Yorick points out a few interesting things. From his speech we can conclude Yorick was a very energetic character and after he died "and now, how abhorred in my imagination it is!" I suppose that Hamlet is trying to communicate his fear of death.
Hamlet is presented as a devout character and his faith is the only thing that prevents him from committing suicide (read his first soliloquy). However, his mention of Yorick shows signs of fear of death. Perhaps this is one of the reasons why Hamlet is wavering on killing Claudius. If he is of religious temperament, why is he so afraid of death? One has to remember that the Church played a very momentous role in people's lives throughout the time when the play took place.
We can also see that Hamlet hesitates to take the life of Claudius when the latter is praying (he is not really praying but Hamlet does not know this), because he believes that if he kills him at that stage Claudius would be granted entrance into heaven. This act of mercy shows that Hamlet believes in Heaven and Hell.
The speech about Yorick is an obvious opposition to his viewpoint and that is the fear of death. Hamlet, being a scholar and a philosopher, begins to doubt his religious stance. He is not a man of deed like Fortinbras, his counter-balance.