in reply to replace first occurance if it doesn't already match

This works on the input you provided. It looks for the 1st digit followed by an underscore and replaces _ with :. Refer to s///
use warnings; use strict; while (<DATA>) { s/(\d)_/$1:/; print; } __DATA__ V12345:name_test V12345_name_test

Replies are listed 'Best First'.
Re^2: replace first occurance if it doesn't already match
by ddrew78 (Beadle) on Mar 10, 2017 at 16:32 UTC
    Worked like a champ. Very much appreciated.