Article View: comp.lang.perl.misc
Article #55Re: Find and Replace Perl function?
From: Mike Linksvayer
Date: Sun, 28 Jan 1996 00:00
Date: Sun, 28 Jan 1996 00:00
34 lines
1506 bytes
1506 bytes
In article <4egegu$ktj@shellx.best.com>, Jeff Dilcher <dilcher@shellx.best.com> wrote: >I have a whole set of web files; about 40 of them. >I would like to change a block of text in each one >(the text is a trailer section that is consistant in each one). > >I am a little stumped about how to write a little perl >routine to do this. Does Perl have a built in function >that can identify and replace a whole block of lines of text? > >Anyone have a little pointer about the best way to go about doing >something like this? > >If I have to edit each file manually, and make the changes, >I might go insane! I asked a similar question a few months ago, and a perl god, gamer, and hiker responded with the following: #Learn about # # perl -00 # #and the # # s/foo/bar/s # s/foo/bar/m # s/foo/bar/sm # #flags. Works great, although I think perl -0777 worked better for me. As far as I can tell, the latter three flags only work in perl 5. Mike Linksvayer http://www.au.com/ml/
Technical Details
Message-ID:
<4eglv8$c12@shellx.best.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4egegu$ktj@shellx.best.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11488e,3978647afc3f661a X-Google-Attributes: gid11488e,public X-Google-Thread: fa0ae,3978647afc3f661a X-Google-Attributes: gidfa0ae,public From: au@shellx.best.com (Mike Linksvayer) Subject: Re: Find and Replace Perl function? Date: 1996/01/28 Message-ID: <4eglv8$c12@shellx.best.com> X-Deja-AN: 136858953 references: <4egegu$ktj@shellx.best.com> organization: AU newsgroups: comp.lang.perl.misc,best.www