Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

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 Cwd module to get the current directory, then use the File::Spec module to join the directory name with the filenames to get an absolute path. Print the list of paths to standard output 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 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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint