while () { next if (/^(PA(?!TY)|PB|PC).*/); print $_; } __DATA__ PAfr PBhghg PAY fvfv PT PATE PATY hfkd dfffPATY