in reply to If line is followed by line, delete both lines

#!/usr/bin/perl # http://perlmonks.org/?node_id=1171814 use strict; use warnings; $_ = join '', <DATA>; s/^.*cat.*\n.*dog.*\n//gm; print; __DATA__ dog cat dog dog cat goat