You are viewing the version of this documentation from Perl 5.41.5. This is a development version of Perl.
%ENV

The hash %ENV contains your current environment. Setting a value in ENV changes the environment for any child processes you subsequently fork() off.

As of v5.18.0, both keys and values stored in %ENV are stringified.

my $foo = 1;
$ENV{'bar'} = \$foo;
if( ref $ENV{'bar'} ) {
    say "Pre 5.18.0 Behaviour";
} else {
    say "Post 5.18.0 Behaviour";
}

Previously, only child processes received stringified values:

my $foo = 1;
$ENV{'bar'} = \$foo;

# Always printed 'non ref'
system($^X, '-e',
       q/print ( ref $ENV{'bar'}  ? 'ref' : 'non ref' ) /);

This happens because you can't really share arbitrary data structures with foreign processes.