s_gaurav1091 has asked for the wisdom of the Perl Monks concerning the following question:
Now my array contains data in the form oracle_hst_sid=hsta oracle_sid=sdpa oracle_home=/oracle/product/10.2.0 sdp_home=/oracle/oracle8 I want it to contain data in the form oracle.hst.sid=hsta oracle.sid=sdpa and so on .I am tryng to reduce my steps..please helpmy @envArray = `rsh sdp1 su - oracle8 -c env `; my $i = 0; my @array; foreach(@envArray) { if($_ =~ (/^(ORACLE_SID)\=(.*)/i)|(/(ORACLE_HST_SID)\=(.*)/i)| +(/(ORACLE_HOME)\=(.*)/i)|(/(SDP_HOME)\=(.*)/i)) { my $temp = lc($1); #$temp = s|_|.|; $array[$i] = "$temp=$2\n"; $i++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: substitution in a string
by pjf (Curate) on Sep 28, 2005 at 08:54 UTC | |
|
Re: substitution in a string
by GrandFather (Saint) on Sep 28, 2005 at 08:41 UTC | |
by pjf (Curate) on Sep 28, 2005 at 09:03 UTC | |
|
Re: substitution in a string
by skillet-thief (Friar) on Sep 28, 2005 at 08:47 UTC | |
|
Re: substitution in a string
by Roy Johnson (Monsignor) on Sep 28, 2005 at 12:55 UTC | |
by Roger_B (Scribe) on Sep 28, 2005 at 13:32 UTC | |
by Roy Johnson (Monsignor) on Sep 28, 2005 at 14:36 UTC |