programming-examples/perl/Datatype/Dereferencing a Reference.pl

16 lines
513 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/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";