#!/usr/bin/perl
#
# examples of references 
# Oct 7 2004 in class
#
use strict;
use warnings;
use Data::Dumper;

my @array1 = ( 100, 101, 102 );
my $ref_a1 = \@array1;

my @array2 = ( 10, 11, 12 );
my $ref_a2 = \@array2;

my @matrix = ( $ref_a1, $ref_a2 );   # an array of array references
print " here's a perl matrix : \n";
print Dumper(@matrix);

my @matrix2 = ( [100, 101, 102],
		[10, 11,   12 ]
	      );


print " --------------------- \n";
print " array : @array1 \n";
print " ref   : $ref_a1 \n";

print " array from ref : @$ref_a1 \n";
print " array from ref : @{$ref_a1} \n";
print " 0th element : $array1[0] \n";
print " 0th from ref : $ref_a1->[0] \n";
print " 0th from ref : $$ref_a1[0] \n";

