Programming in Perl

Homework 4

Frequently Asked Questions

  1. Is there an easy way to delete a member of a hash?
    Why yes, yes there is. delete $hash{$key};
  2. For the searching, do we have to use pattern matching? (ie, if the user searches for "Tom", do we print out all movies starring either Tom Hanks or Tom Cruise)
    No. For a search term to "match" it must match the movie information exactly - except for case insensitivity.
  3. What is the format of the data file?
    Any format you choose. Your script will only be given an input file that your script itself generated.
  4. What should happen if the user tries to add a movie with an identical title to one already in the database?
    Print a suitable error message and return to the main menu.
  5. How do we sort Alphabetically, instead of ASCIIbetically, so that 'a' doesn't come after 'B'?
    Use the lc() or uc() functions, which return their arguments in all the same case:
    @sorted = sort {lc($a) cmp lc($b)} @unsorted