s/\$ENV{(\w+)}/$ENV{$1}/ge;
That doesn't solve the 'problem' of wanting to have a literal '$ENV{X}' kept unchanged for some reason. That seems unlikely enough of a desire that I'm not sure I'd even do anything about it. Though I might prevent substitution if no such environment var is set:
s/\$ENV{(\w+)}/ exists $ENV{$1} ? $ENV{$1} : "\$ENV{$1}" /ge;
- tye
In reply to Re: What's the best way to convert a non interpolated single-quoted string into an interpolated double-quoted string? (smor)
by tye
in thread What's the best way to convert a non interpolated single-quoted string into an interpolated double-quoted string?
by emilbarton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |