while () { print and next if (/$foo/); print if (/$bar/); }