411 REFERENCE · Wikibooks
Perl Programming/References and data structures
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Perl Hash variables User input-output
Introduction
So you've been plodding along with your perl scripts, fiddling with arrays and hashes and suddenly you realize that you would like to pass a function to another function depending on the data you encounter, or perhaps you would like to get back a hash when you look up an array index. References are the thing for you, allowing you to build and pass around ever more complex data structures.
Referencing and dereferencing syntax
my $nightmare = "clowns";
my $ref = \$nightmare;
print "I laugh in the face of " . ${$ref} . "\n";
Output should be I laugh in the face of clowns.
The curly brackets are optional, but generally recommended.
External links
http://perldoc.perl.org/perlref.html
http://perldoc.perl.org/perlreftut.html
Perl Hash variables User input-output