Perl

Menu

Homework 1
Frequently Asked Questions

  1. Do we need to error check the input file? (Part A)
    Yes and no. You should be checking that there were two values on the line of the input file. You do not need to verify that the values are in fact numeric, as the way to do that correctly involves Regular Expressions
  2. All of my file test operations are failing, even though the files are definately there. What's wrong? (Part B)
    You're most likely being bit by three different features working in conjunction: 1) a simple opendir() does not change the current working directory of the script; 2) The readdir() function returns only filenames, not entire paths; 3) The file test operations look for the file given relative to the current working directory.
    See also: perldoc -f readdir (2nd paragraph)
  3. If the directory we're searching contains a subdirectory, do we need to search the files in that subdirectory as well? (ie, Does our program need to recurse directories?) (Part B)
    No. This is not a requirement of the assignment. Any directories found in the given directories should be ignored. (Note that they should *not* be added to either the count of file names nor first-lettered file names)
Perl Quotes
Perl Quotes