PerlIO::Scalar

Supports in-memory I/O. It exists so it can use XSLoader to load C code that supports treating a scalar as an “in-memory” file. PerlIO::Scalar allows all normal file operations to be performed on the handle. Returns undef.

For example:

#!/usr/local/bin/perl -w
use PerlIO::Scalar;
open($fh, "<...", \$some_scalar);

This module is part of the core Perl distribution starting with Perl 5.8.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.