There will always be poor people in the land. Therefore I command you to be openhanded toward your brothers and toward the poor and needy in your land (Deut 15:11)
Here’s a great article about how to give charitably. It’s an interview, actually, with Father Sirico (of the Acton Institute) about selfish charity.