References to scalar variables
$wordref = /”the”;
$$wordref = “the”;
Print $$wordref;
References to Arrays
@sentence = qw(this is a book);
$sentenceref = /@sentence;
$sentenceref =[“this”, ”is”, ”a”, “book”];
$$sentenceref[1] = “any”;
Print $$sentenceref[0];
Print $sentenceref->[0];
Print @{$sentenceref}[0];
Print @{$sentenceref}->[0];
References to Hashes
%counts = (the=> 1000, and=>2000);
$countsref = /%counts;
$countsref = {the=>1000, and=>2000};
Print $countsref->{$key}
Arrays of arrays
@data = ([1,2,3], [‘a’, ‘b’, ‘c’], [1.1, 2.2]);
Print @{$data[0]}
Print $data[2][1];
Print $#data;
Hashes of Hashes
%data = ({the=>100, and=>200}, {the=>300, and=>400 }, {hello=>300});
%data = (order => {a => 1, b => 2, c => 3}, length => {a => 1, b => 1, c => 1});
print "$data{order}->{b}";
print "$data{length}{c}";