#!/usr/local/bin/perl # Jaime Prilusky, 2004 Some examples of references: $scalarref = \$foo; $arrayref = \@ARGV; $hashref = \%ENV; $coderef = \&handler; $globref = \*foo; Reference to an anonymous array $arrayref = [1, 2, ['a', 'b', 'c']]; $arrayref->[2][1] would have the value "b" Reference to an anonymous hash $hashref = { 'Adam' => 'Eve', 'Clyde' => 'Bonnie', }; $hashref->{'Clyde'} would have the value 'Bonnie' Reference to an anonymous subroutine $coderef = sub { my($msg) = @_; print "Message is: $msg\n" }; $coderef->("Hi");