You are viewing the version of this documentation from Perl 5.36.3. View the latest version
${^OPEN}

An internal variable used by PerlIO. A string in two parts, separated by a \0 byte, the first part describes the input layers, the second part describes the output layers.

This is the mechanism that applies the lexical effects of the open pragma, and the main program scope effects of the io or D options for the -C command-line switch and PERL_UNICODE environment variable.

The functions accept(), open(), pipe(), readpipe() (as well as the related qx and `STRING` operators), socket(), socketpair(), and sysopen() are affected by the lexical value of this variable. The implicit "ARGV" handle opened by readline() (or the related <> and <<>> operators) on passed filenames is also affected (but not if it opens STDIN). If this variable is not set, these functions will set the default layers as described in "Defaults and how to override them" in PerlIO.

open() ignores this variable (and the default layers) when called with 3 arguments and explicit layers are specified. Indirect calls to these functions via modules like IO::Handle are not affected as they occur in a different lexical scope. Directory handles such as opened by opendir() are not currently affected.

This variable was added in Perl v5.8.0.