To take care of undefined environment variables you can code something like
$path =~ s<\$(\w+}/>< $ENV{$1} // $1 >ge;
if you are under at least Perl 5.10. The /e qualifier causes the replacement to be interpreted as an expression, not a string. Note that I had to change the delimiters to something other than C<'/'> to accommodate the defined-or operator.
In reply to Re: How to replace envs in path?
by Anonymous Monk
in thread How to replace envs in path?
by ovedpo15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |