introduction to web programming Creating References There are several ways to create a reference depending on what type of object you want to reference.

The most basic method for creating a reference is to use the backslash (\) operator. For example, to create a simple scalar reference, you would use something like the following:

     $name = "Selena Sol";
     $reference = \$name;

Notice the backslash character before $name.

Creating array, hash and subroutine references follows the exact same process such as:

     $array_reference = \@array_name;
     $hash_reference = \%hash_name;
     $subroutine_ref = \&sub_name;
Previous | Next | Table of Contents