Why would name have been an inappropriate search key for the Customer program you wrote in this hour, especially if the customer list were much, much longer?
Combinations of last name and first name would have been more than Perl's hashes would allow.
People's names are not unique keys.
No one would ever want to search a customer database by name.
What's the difference between an associative array and a hash?
Associative arrays are used on more formal data sets, such as billing records.
Hashes aren't really associative arrays in Perl, so they have a different name.
What kinds of data are best suited for hashes?
b. Perl's hashes are virtually unlimited in size, and users will (inevitably) ask for a search by name. But people's names are inappropriate, because they're not unique. The phone book has many, many duplicate names such as John Smith and Robert Jones.
a. Hashes and associative arrays are identical. The only difference is that hash is much easier to say and to spell.
c. Choice c is the correct answer, although a nice corned-beef hash can really round out breakfast.
Modify the Customer program to allow a search by name. Because you cannot use name as a hash key, you need to search through the values in the hash.
Modify the Customer program to allow searching by a partial key (for example, part of a phone number or part of an email address). You can use regular expressions to search for the patterns. Simply keep in mind that you could find multiple results and you should return each one.
© 2000- NIV