http://www.perlmonks.org?node_id=29601

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

$a="hi"; $b ="hello"; $c = "hibobhi"; $c=~ s/$a/$b/;
How can I make $c = "hellobobhello" not "hellobobhi"?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How can a regex match every occurence of a string?
by agoth (Chaplain) on Aug 25, 2000 at 15:17 UTC
    use /g; as your modifier.