the paths you do no want to expand are any where the scalar sigil $ is not immediately after the filepath separator. In which case you can allow these by matching for that construct.
my $fps = 'filepathseparator'; m! $fps # your file path separator \Q$\E # quoted scalar sigil (shell variable expansion) \{? # start shelling out for a return value ? ([^\W]+) # your environment variable, not containing, # one or more non-word characters \}? # end shelling out for a return value ? !x
This should match both cases where the curly braces are or are not used while constraining the variable to starting immediately after the file_path_separator (no mid/end word sigils match), and not allowing the path word to contain any non word characters.
In reply to Re^3: How to replace envs in path?
by Don Coyote
in thread How to replace envs in path?
by ovedpo15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |