my $path =~ s/\$\w+(?=\/)/$subst_var/;