If there's a suspected perforation, you wouldn't want to waste your time with an endoscopy (and cause further iatrogenic damage). Perforation = emergency. After examination, the first test to order would be an upright abdominal X-ray to look for infradiaphragmatic free air. The most sensitive test is indeed CT to detect the free air. It can also be used for differential diagnosis (cholecystitis, pancreatitis, etc.)