Modifying a string

How would I go about making this modification?
I am reading these 2 strings from a file

/usr/test/src: testcode.cpp

I would like to change it to this:


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

$x="/usr/test/src: testcode.cpp";
$x=~s#: #/#

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jeweeAuthor Commented:
What if I have 2 separate strings?
what does this mean?
assuming that each string is in $x, then there is no change
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

jeweeAuthor Commented:
I am reading in a line from a file:

        $cmFile1 = (split)[1];
        $cmFile2 = (split)[2];
Kim RyanIT ConsultantCommented:
Just assgin your regexp to each variable
$cmFile1 =~s#: #/#;
$cmFile2 =~s#: #/#;

jeweeAuthor Commented:
This is what I am trying to do...

I have 2 strings -
$cmFile1 = (split)[1]
$cmFile2 = (split)[2]

(split)[1] is /usr/test/src:
(split)[2] is testcode.cpp

remove : and merge the 2 into one path:

Kim RyanIT ConsultantCommented:
$cmFile1 =~s#:#/#;
$final_name = $cmFile1 . $cmFile2;
$cmFile1 =~ s!:!/$cmFile2!;
you don't need to split and then join again, just do in one subsitution (see http:#14364286 )
or do I miss something?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.