Practicing Perl:


due: December 17, 2002. (Submit electronically, via caddis.acad.emich.edu.)

Write a perl script that prompts the user to provide a name of a directory, and then a letter of the alphabet. The script should output a table of all the files with names beginning with that letter in that directory.  Each line of the output should be the name of one of the files, followed by the size, in bytes, of that file.  The last line of output should be the sum of the file sizes.

You may want to use the unix "/bin/ls -l" command to get the information about the appropriate files.

Example:

If the user requests directory "/etc" and all files beginning with "s", the output would be something like:

sysconfigtab.7                           1067 
sysconfigtab.9                           1214 
sysconfigtab.9.5                         1214 
sysconfigtab.GENERIC                     2547                       
sysconfigtab.PreDel_OSFPAT00018900410   27203 
sysconfigtab.PreMRG                     30548 
sysconfigtab.PreUPD                     33553 
sysconfigtab.lite                        1897 
syslog.auth                                14 
syslog.conf                              2067