|
|
| P is for Practical | |
| PerlMonks |
Re^2: substitution in a stringby Roger_B (Scribe) |
| on Sep 28, 2005 at 09:32 UTC ( [id://495730]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
One problem with this - it will substitute . for _ in all environmental variables.
How about /^(?i:ORACLE_SID|ORACLE_HST_SID|ORACLE_HOME|SDP_HOME)=/ && s/([^=]+)/(my $lhs=$1) =~ tr:_:.:; $lhs/e for @envArray; Roger update: better idea by Roy Johnson below. Doh! However his code doesn't actually work because the brackets are the (?imsx-imsx:pattern) extension. Below is a possible fix: s/^((?i)ORACLE_SID|ORACLE_HST_SID|ORACLE_HOME|SDP_HOME)(?==)/(my $lhs=$1) =~ tr:_:.:; $lhs/e for @envArray;
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||