opensourcer has asked for the wisdom of the Perl Monks concerning the following question:
That's it#!/usr/bin/perl -w #opening Rules1.txt for reading open(FILE, "<Rules1.txt") or die "unable to open Rules1.txt: err at $! +"; #copying everything to array #what if it's huge file # i don't what to do @array = <FILE>; #closing the file handle close(FILE); #im looping so that i can replace with what im looking for foreach $line (@array) { $line =~ s#<b>#/*<b>#ig; $line =~ s#</b>#</b>*/#ig; } #again open for writing open(FILE, ">Rules1.txt") or die "unable to open Rules1.txt: err at $! +"; #write to FILE print FILE @array; #close FILE close (FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: replaceing text in file using replace prattern
by Thilosophy (Curate) on Feb 07, 2005 at 09:16 UTC | |
|
Re: replaceing text in file using replace prattern
by pingo (Hermit) on Feb 07, 2005 at 10:16 UTC | |
|
Re: replaceing text in file using replace prattern
by gube (Parson) on Feb 07, 2005 at 09:45 UTC | |
|
Re: replaceing text in file using replace prattern
by kprasanna_79 (Hermit) on Feb 07, 2005 at 13:48 UTC |