Dereferencing a Reference
#!/usr/local/bin/perl -w
# Set up the data types.
my $scalarVar = "Tom was here.";
my @arrayVar = qw (Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
my %hashVar = ("Toronto" => "East", "Calgary" => "Central", "Vancouver" => 'West');
# Create the references
my $scalarRef = \$scalarVar;
my $arrayRef = \@arrayVar;
my $hashRef = \%hashVar;
# Print out the references.
print "$scalarRef \n";
print "$arrayRef \n";
print "$hashRef \n";
Related examples in the same category