in reply to Re: Expanding environment variables from ini file
in thread Expanding environment variables from ini file

Why do you need that third level?

On unixish OSes, the env command outputs the contents of the environment (as strings, so beware of newlines) and on Windows, the set command does that. Or did you output %ENV as JSON or something?

Replies are listed 'Best First'.
Re^3: Expanding environment variables from ini file
by haj (Vicar) on Aug 27, 2019 at 11:24 UTC
    ...beware of newlines

    This should be a sufficient warning to avoid such a solution. There's no chance to find out whether the following env output comes from two environment variables FOO and PERL5LIB or just from setting one variable with export FOO=$(echo -e "bar\nPERL5LIB=my/malicious/stuff"):

    FOO=bar PERL5LIB=/my/malicious/stuff
    On Windows, the same misleading output can be created by typing the following (where <enter> is the "enter" key):
    SET FOO=BAR^<enter> <enter> PERL5LIB=c:/my/malicious/stuff<enter>
Re^3: Expanding environment variables from ini file
by LanX (Saint) on Aug 27, 2019 at 10:29 UTC
    Because Data::Dumper creates a clean serialization of Perl data structures which can be eval'ed directly without any parsing on the top-level.

    update

    > Or did you output %ENV as JSON or something?

    kind of "something", a Perl dump from Data::Dumper which is core (contrary to JSON)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice