Chapter 8. USING PERL REFERENCES AND MODULES

Introducing References

Perl references act as pointers to information that is stored somewhere else. The idea is based upon C or C++ pointers, except that Perl maintains the structure of the referenced data in its original form.

You normally use a scalar variable to store the lowest level of a reference in the Perl code that originally initialized the reference. In fact, when a Perl module is initialized, its handle is made available as a scalar. From that scalar reference, all of the module's variables, libraries, and methods are made available to the original Perl script.

For subroutines, using a reference as a parameter makes it easier to update the data within the subroutine itself.

References are actually ...

Get Perl and Apache: Your visual blueprint for developing dynamic Web content 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.