in reply to question on sed
Why, oh why are you calling sed? Perl has very good regular expression support of its own:
open(IN, '<', $File1) or die $!; open(OUT, '>', $Replace_html) or die $!; while(my $line = <IN>) { $line =~ s/$c/$b/g; print OUT $line; } close(IN); close(OUT);
Might be a little longer, but it doesn't rely on an external program. Plus it uses Perl's regular expressions, which are far and away better than sed in almost any way you can think of.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: question on sed
by Anonymous Monk on May 15, 2003 at 16:20 UTC | |
by hardburn (Abbot) on May 15, 2003 at 16:27 UTC | |
by halley (Prior) on May 15, 2003 at 16:44 UTC | |
by LameNerd (Hermit) on May 15, 2003 at 16:41 UTC |