From the course: Perl 5 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Understanding values and references - Perl Tutorial
From the course: Perl 5 Essential Training
Understanding values and references
- [Voiceover] A reference is a scaler that refers to a value. The target value may be a scaler, an array, a hash, or a function. The reference itself is a scaler value. You create a reference with the backslash character. You may create a reference to a scaler, an array, a hash, or a function. You may then access the target value by dereferencing using the correct type symbol and enclosing the scaler reference in curly brackets. Or for convenience, you may use the arrow operator to dereference and access structure members at the same time. References allow the use of anonymous arrays, hashes, and functions. This can be extremely handy for creating complex data structures. If you need to know the type of reference, you may use the ref function. The ref function returns a string indicating the type of the referenced value. References are an important part of the Perl language. You'll use them to create rich, complex data structures, and you will see them often in existing code.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.