19 lines
617 B
Perl
19 lines
617 B
Perl
#Perl references are also called pointers.
|
|
#A pointer is a scalar variable that contains the address of another variable.
|
|
#To create a pointer, the backslash operator is used.
|
|
|
|
# Create variables
|
|
$age = 25;
|
|
@siblings = qw("A", "B", "C","D");
|
|
%home = ("owner" => "A",
|
|
"price" => "B",
|
|
"style" => "C",
|
|
);
|
|
|
|
# Create pointer
|
|
$pointer1 = \$age;
|
|
$pointer2 = \@siblings;
|
|
$pointer3 = \%home;
|
|
$pointer4 = [ qw(red yellow blue green) ]; # Create anonymous array
|
|
$pointer5 = { "A" => "a", "B" => "b", "C" => "c" };
|
|
# Create anonymous hash |