Chapter 4

Working with Data

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Working with scalars
  • Working with arrays
  • Working with hashes

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at http://www.wrox.com/WileyCDA/WroxTitle/Beginning-Perl.productCd-1118013847,descCd-DOWNLOAD.html on the Download Code tab. The code for this chapter is divided into the following major examples:

  • example_4_1_names.pl

This chapter shows you much of the basic data manipulation available in Perl to help you Get Stuff Done. Quite frankly, this chapter is boring. It serves more as a reference chapter that you can conveniently flip back to when you want to understand how to manipulate data in a particular way. If you like, you can think of it as an appendix slipped into the front of the book. The builtins described here are not an exhaustive list. They’re the ones you’re most likely to encounter in your daily work.

For many languages there is a strong distinction between operators and functions. This distinction is less clear in Perl. Some things that look like functions are sometimes referred to as named unary operators (see perldoc perlop). To sidestep the inherent ambiguity, many Perl developers refer to operators and functions as built-ins (sometimes spelled builtins, as is done here). This book often uses these terms interchangeably. A builtin, in this context, means an operator or function built in to the Perl language.

NOTE Subroutines and functions are ...

Get Beginning Perl 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.