Linux Magazine: Getting Better References Through Perl | Linux Today

Linux Magazine: Getting Better References Through Perl

Written By
Web Webster
Web Webster
May 20, 2000

“You need references. Everybody programming in Perl does, since
they are one of the basics of the language. A bit like C’s
pointers, references can be used to refer to all sorts of other
things, including scalars, arrays, hashes, filehandles, typeglobs,
subroutines, and synthetic data structures. If C calculates
addresses and dereferences pointers with & and *, respectively,
Perl does much the same with and $.”

“Why use references? First, they go great with subroutine
calls.
The usual way to pass an array or hash between a
subroutine and its caller involves pushing around all the values of
the array or hash. You can get the same or better results instead
by passing just the single reference to the array or hash.”

“Also, references are necessary for complex data structures. The
values of arrays and hashes must be scalars, so there’s no direct
way to make hashes of hashes. However, references have the syntax
of scalars, so you can make arrays of references to arrays
of….”

Complete
Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.