in reply to Print value from hash

This answer and more can be found in perlintro -- a 20 minute read. To save time for this specific task (at the expense of leaving other questions unanswered), skip to perlintro#Perl-variable-types. Hashes are discussed there, and examples exist on how to index into a hash.

In your specific code example, you are dereferencing a scalar named $name as if it contains a reference to a hash. And presumably you are getting a strict violation at compile time because no variable, "$name" exists. %name is a first class hash, and elements are accessed via direct index rather than dereferencing: $name{$search}[0] would return 'main'. $name{$search} would return a reference to the array that contains 'man', and '100 - Main Street'.

Handling references is introduced in perlreftut.


Dave