in reply to Environment discovery under Linux

In addition to the advice already provided, it is generally not necessary to create a temporary output file when running a command out to the shell. Instead of running the command via system, it is simpler to just collect the command's output in an array using qx:
my @lines = qx(env);