0

Let's say on my current shell, I have an environment variable - A_VAR set to "/tmp/"

I am defining a perl variable as (which is using A_VAR) -

my $path = "${A_VAR}/this/path/file.txt";

I am looking for a module which provides a function to convert $path to /tmp/this/path/file.txt

1 Answer 1

4

I would suggest just using A_VAR directly:

my $path = "$ENV{A_VAR}/this/path/file.txt";

If A_VAR may be non-absolute, that's a separate thing to handle - there are many modules that do this work, depending on how you like to interact with it. File::Spec, Path::Tiny, etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.