while (){ if (/foo/ && /bar/){ print $_ } } __DATA__ fobur barfoo foobar fobar bar foo