s...@missionstclare.com wrote:
I'm running PERL under the MACOSX.

It is spelled Perl, not PERL.   :-)


The line

$text=~s/george/tim/;

causes a global substituion of "george" with "tim"

How can I limit the substituion to the first instance only?

Global substitution only works if you use the /g option but your example does not use the /g option so it will only replace the first 'george' it finds.



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to