Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: replace first occurance if it doesn't already match

by toolic (Bishop)
on Mar 10, 2017 at 16:26 UTC ( [id://1184185]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1184185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 04:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found