Typically its an emission fault. Nothing thats going to strand you but something that should be checked out. If the light flashes, I wouldn't drive because catalyst damage could result.
Leaving the gas cap loose can turn this light on too but just because you tighten it down doesn't mean its going to shut the light off.
The system will have to go through a couple of trip cycles before it realizes a clearable fault and if the problem is corrected will shut the light off on its own.
DO not buy parts because some nimrod at Autozone says "it might be this" They cannot diagnose and it says so right on their stupid little printout.