perl - eliminating text which include new lines -


working perl , reading file line line, need eliminate text included between 2 specific words (let's "dog" , "cat"), don't know how when there various lines bewtween both words. iim tryng use "s" modifier, means dot (.) can interpreted new line, doesn't work:

use warnings; use strict; $filename = shift; open f, $filename or die "usa: $0 filename\n"; while(<f>) { s/dog.*?cat//s; print; } close f; 

you reading in file line line, substituting. if want whole text @ once, set input record separator undef

local $/; 

then, when <f>, whole file content, , substitution should work.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -