If I understand your problem correctly the line of code you want is @newArray = (map {tr/_/./; $_} @array):
my @newArray = ( map {my ($lhs, $rhs) = /(.*?)=(.*)/; $lhs =~ tr/_/./; "$lhs=$rhs"} @array );
use strict; use warnings; my @array = qw( oracle_hst_sid=hsta oracle_sid=sdpa oracle_home=/oracle/product_1/10.2.0 sdp_home=/oracle/oracle8 ); my @newArray = ( map {my ($lhs, $rhs) = /(.*?)=(.*)/; $lhs =~ tr/_/./; "$lhs=$rhs"} @array ); print join "\n", @newArray;
In reply to Re: substitution in a string
by GrandFather
in thread substitution in a string
by s_gaurav1091
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |