In my Perl script I get strings of file paths that may contain environment variables, e.g. $FONTS/test.ttf or $TMP/file.txt.
I now want to open those files like this:
open my $handle, "<$filename" or die $!;
How can I now expand the environment variables prior to the open call, as e.g. the bash shell would do?
If the environmental variables are set, you can use a simple substitution: