in reply to Re^2: Efficient way to replace a set of values with another set of values
in thread Efficient way to replace a set of values with another set of values
Indeed. I was in two minds about whether to include it or not. The substitutions in the examples were consistently at the start of lines, but the OP never explicitly specified that that would always be the case, so I decided to go for the more general "anywhere in the string" match.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In Section
Seekers of Perl Wisdom