O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using References with Subroutine Arguments and Return Values

So far, you've got a basic idea of how references work. There's still lots more detail to explain about creating and using references, but let's stop for a moment and do something practical. On Day 11, “Creating and Using Subroutines,” when we talked about sub- routines, I mentioned that lists and subroutines tend to be somewhat awkward without references. Let's revisit that topic and explore how references can make subroutine list arguments and return values much easier to manage.

Subroutine Arguments

As you already know, Perl has a very basic capability to pass arguments into and out of subroutines. All list arguments into a subroutine are flattened into a single list and stored in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required