split(/\n/, "hello\nworld") -> ("hello", "world") split(/(\n)/, "hello\nworld") -> ("hello", "\n", "world") #### $text = join '', grep $_ ne "$word\n", split /(?<=\n)/, $text;