while () { if (!/,\s+$/) { print; } } __DATA__ 1) this is an example 2) this is an example, 3) this is an example, 4) this is an example