Perl references: create, dereference and debug with confidence
Learn enough to be dangerous with one of Perl’s most powerful features
Learn enough to be dangerous with one of Perl’s most powerful features
Hashes are one of Perl’s core data types. This article describes the main functions and syntax rules for for working with hashes in Perl.
Perl is remarkably flexible and allows you to achieve all kinds of wizardry with the language. One example of this is using a dereferencing block to use a scalar value as a variable name. This allows you to use variables with dynamic names.
When Perl is executing a program, it maintains the user id of the process owner in a global variable ($<). When a Perl program is executed by root or a user with root privileges (e.g. using the sudo command), the user id variable is always set to zero. This can be checked at the command line:
A typical way to print every element of an array in Perl is using a foreach loop:
Broadly speaking Perl has two types of strings: quotes that are interpolated at runtime and literal quotes that are not interpolated. Let’s review each of these in turn.