Wouldn't it be this instead?

substr $_, index($_, $ss), length($ss) = $rs;


I was looking up substr and didn't see a fourth parameter.  Didn't have a chance to 
try it either :-)

Thx
> On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote:
> 
> >
> > A quick question for the wizards--
> 
> Will I do?
> 
> > Is it possible to do a substitution without compiling the pattern at 
> > all?
> 
> Sure.
> 
> > **************************************
> > #!/usr/bin/perl
> >
> > $ss = "cool???";
> > $rs = "cool.";
> > $_ = "Perl is really cool???";
> > s/$ss/$rs/g;
> 
> The above line could also be written:
> 
> substr $_, index($_, $ss), length($ss), $rs;
> 
> > print "$_\n";
> > **************************************
> 
> Hope that helps.
> 
> James
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to