Short-term memory
Information about a needle being sharp and hurtful when touched by bare hands is processed to make a response of survival and self-preservation. This leads to us (and other animals) to change what we do when we met needles a second time. Memory, which starts out as short-term memory allows for learning, and helps intelligent behavior.