Harry Putnam wrote:
>
> Something I'm messing with today and can't get right. I've presented
> a simplified version of what I'd like to do. It amounts to setting
> the strings inside a s/some_re/some_rep/ type action.
>
> I can get it to work fine if both elements are simple and don't
> involve grouping and back reference. But grouping and back reference
> would make my script (the real one ) considerably more versatile.
>
> Examples:
>
> cat rein.pl
>
> #!/usr/local/bin/perl -w
> $strp_re = shift;
You COULD compile this to a regex now which is a bit more efficient.
my $strp_re = qr/@{[shift]}/;
> $rein_str = shift;
>
> while(<>){
> chomp;
> $pre_out = $_;
> ($out = $pre_out) =~ s/$strp_re/$rein_str/;
($out = $pre_out) =~ s/$strp_re/qq["$rein_str"]/ee;
> print "$out\n";
> }
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]