while () { print if m/bar/ && !m/foo/; } __DATA__ some stuff then foo then bar then more stuff oo then bar then more stuff some stuff then foo then bar then more stuff some stuff then bar then more stuff