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
29 Attempting to open a read-only scalar for writing will fail, and if
30 warnings are enabled, produce a warning.
31
33 "PerlIO::scalar" only exists to use XSLoader to load C code that
34 provides support for treating a scalar as an "in memory" file. One
35 does not need to explicitly "use PerlIO::scalar".
36
37
38
39perl v5.36.3 2023-11-30 PerlIO::scalar(3pm)