For example, you might be worried that you don't have enough money for a new laptop computer. Then you watch a TV show about people living in slums who can't even afford to eat. You might say to yourself: "That puts my problem into perspective."
In the case you mention, the student might have been thinking, "All people are selfish and only care about themselves". Then this happens, and he realises that some people actually care. It puts his thoughts into a proper perspective.