Section 15.4. Exercise


15.4. Exercise

See Appendix A for answers to the following exercise:

  1. [15] Install the Module::CoreList module from CPAN. Print a list of all of the modules that came with Perl 5.006. To build a hash whose keys are the names of the modules that came with a given version of Perl, use this line:

         my %modules = %{ $Module::CoreList::version{5.006} }; 

  2. [15] Get a list of filenames in the current directory. Use the C<Cwd> module to get the current directory, then use the C<File::Spec> module to join the directory name with the filenames to get an absolute path. Print the list of paths to standard outout with one path per line. Your solution should be portable to other operating systems.

  3. [15] Using the output from the previous exercise, read in a list of paths and use the C<File::Basename> module to extract the filename from each path. Print each name on a line by itself. Your solution should be portable to other operating systems.



Learning Perl
Learning Perl, 5th Edition
ISBN: 0596520107
EAN: 2147483647
Year: 2003
Pages: 232

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net