in reply to regexp matching bad stuff ...

Replace -p (which unconditionally prints every line) with -n (which doesn't)

While you're at it, replace
cat access_log | perl ...
with
perl ... < access_log