You could alias $_ to $str, which would allow you to at least get rid of the repetitive "$str =~ " part in every line.
Other than that, you do have to declare somehow what to replace with what, and this get can hardly get any more compact than a list of s/.../.../ (unless there is some pattern or regularity in the tag-substitution pairs that would allow you generate them automatically — but I suppose the ones given are not the real ones).
for ($str) { s/tag1/subst1/; s/tag2/subst2/; s/tag3/subst3/; ... s/tag49/subst49/; }
In reply to Re: reg. expr. multiple substitutions
by Eliya
in thread reg. expr. multiple substitutions
by silentius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |