in reply to Repeated substitution on 1 side of a line only

No verbs needed. Just replace - with _, and once you find :, replace the whole remainder of the string with itself:
perl -pe 'BEGIN { %h = qw( - _ ) } s/(-)|(:.*)/$h{$1}$2/g'

Explanation: One of $h{$1} and $2 is always empty, as only one part of the alternative can match.

Update: Added the explanation and wrapped the hash initialization into a BEGIN.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Repeated substitution on 1 side of a line only
by tybalt89 (Monsignor) on Dec 16, 2016 at 21:31 UTC

    Or skip the hash altogether...

    #!/usr/bin/perl # http://perlmonks.org/?node_id=1177915 use strict; use warnings; while(<DATA>) { s#-|(:.*)# $1 // '_' #ge; print; } __DATA__ session-redis-hosts-fault-tolerant: "tyk-redis-1.gateways.svc.cluster. +local,tyk-redis-2..." message-center-db: "http://message-center-db-1b.message-center-db.svc. +cluster.local"
      I wanted to get the result without /e or any other "advanced" tricks.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,