in reply to /g option not making s// find all matches
As you have figured out the problem is not with the \K anchor, it is with the ^ (match only at beginning of line) anchor.
You can fix that with something like this:
while (<DATA>) { 1 while s/^ ~ .*? \K _ /+/x; print "$_"; }
Or perhaps something like this:
while (<DATA>) { s/^ ~ .*? \K ( .+ ) / ( my $x = $1 ) =~ tr-_-+-; $x /xe; print "$_"; }
In Section
Seekers of Perl Wisdom