Check engine Light on

I just bought a 2008 Hyundai Accent about 2 weeks ago. It has 65,000 miles on it. One week after purchase the check engine light came on. The dealership looked at it and said it was just a leak from the gas cap. So I purchased a new gas cap and the light is still on. I had the guys at AutoZone hook it up to their computer and they said the same thing. They also said that if the light is still on after putting on a new gas cap it could be the fuel injector or a vacuum leak. It has been less than 30 days that I have had this car. What is my next step here? Am I stuck taking it to a mechanic to try to fix these things or is there any way the dealership will admit to selling a car that was less than worthy of sale and help me out?

It may take a couple of days for the drive cycle to turn off the check engine light, assuming that the gas cap was really the issue. I would try to see if the dealership would do a good will diagnosis, given the new information. Did you get any kind of warranty (30 days/50% of the repair) when you purchased? If so, you might want to make an appointment with the dealer sooner, rather than later.

Would also help if you could post the actual code(s) (Pxxxx format), so that folks here can help interpret them.