in reply to Backreference woes
And the output is exactly as expected...#!/usr/bin/perl -w my $searchExp = $ARGV[0]; my $replaceExp = $ARGV[1]; my $textIn = <STDIN>; my $count = 0; # Do the replacing eval "\$count = (\$textIn =~ s/$searchExp/$replaceExp/go)"; if ($count > 0) { print $textIn; } exit;
>> echo 'JHTML `Java in here` code' | perl p11.pl '`(.*)`' '<%=$1%>' JHTML <%=Java in here%> code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Backreference woes
by bemfica (Initiate) on Jan 02, 2004 at 04:44 UTC |