1PerlIO::scalar(3pm) Perl Programmers Reference Guide PerlIO::scalar(3pm)
2
3
4
6 PerlIO::scalar - in-memory IO, scalar IO
7
9 my $scalar = '';
10 ...
11 open my $fh, "<", \$scalar or die;
12 open my $fh, ">", \$scalar or die;
13 open my $fh, ">>", \$scalar or die;
14
15 or
16
17 my $scalar = '';
18 ...
19 open my $fh, "<:scalar", \$scalar or die;
20 open my $fh, ">:scalar", \$scalar or die;
21 open my $fh, ">>:scalar", \$scalar or die;
22
24 A filehandle is opened but the file operations are performed "in-
25 memory" on a scalar variable. All the normal file operations can be
26 performed on the handle. The scalar is considered a stream of bytes.
27 Currently fileno($fh) returns -1.
28
30 "PerlIO::scalar" only exists to use XSLoader to load C code that
31 provides support for treating a scalar as an "in memory" file. One
32 does not need to explicitly "use PerlIO::scalar".
33
34
35
36perl v5.32.1 2021-03-31 PerlIO::scalar(3pm)