Here is a wonderful teaching of the Buddha, where he used the example of monkeys. Some hunters set up traps for the monkeys in mountains. Those monkeys who are wise, upon seeing these traps, do not go near them, and wander away from them. Those monkeys who are not careful, wander into these traps, putting one hand in it. While that gets stuck, they put the next to release the first. Then, the two legs and then the mouth. Thus they get stuck in the traps in five ways. Using this example, the Buddha explained how to avoid the trap of the five kinds of sense pleasures, the improper pastures, and how to move around wisely and carefully in the proper pastures of the four foundations of mindfulness, in the following words. It is taken from Makkata Sutta (The Sutra about the Monkeys, from the Samyutta Nikaya of Pali Sutta-Pitaka)
O bhikkhus, do not wander in improper pastures, in alien territories.
And what, for a bhikkhu, are improper pastures, the alien territories?
The five kinds of sense pleasures.
What are these five?
Forms perceived with the eyes
— appealing, pleasing, charming, endearing, instilling desire and enticing.
Likewise, sounds… odors … flavors… touches…
These are, O bhikkhus, the improper pastures, the alien territories for a bhikkhu.
O bhikkhus, wander in proper pastures, in your own ancestral territories.
And what, for a bhikkhu, are proper pastures, the ancestral territories?
The four foundations of mindfulness.
What are these four?
Here, O bhikkhus, a bhikkhu abides
Observing body as body — ardent, vigilant and mindful –
taming covetousness and irritations with respect to the world.
Likewise, feelings… mind… dharma…
These are, O bhikkhus, the proper pastures, the ancestral territories for a bhikkhu.