If your intent is to do no more than one substitution, then you need program logic to return after a substitution has been made. Something like
might be what you're looking for.$_[0] =~ s/foo/bar/ && return;
By the way, the /o isn't helping you in the slightest.
In reply to Re: Regex Substitution in sub
by dws
in thread Regex Substitution in sub
by peppiv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |