Perl Directory Function Basics

  • Filter
  • Time
  • Show
Clear All
new posts

    Perl Directory Function Basics

    Perl gives you the possibility to create a directory and to delete a directory. It is possible for you to use Perl to create a file and then save the file in a directory of your choice. In this article I introduce you to a tutorial series on Perl Directory Function Basics.

    Before starting the series you need to have basic knowledge in Perl. Your prerequisite knowledge should include the knowledge on how to create and save files (file handling).

    The code samples of the tutorial series are written using ActivePerl. ActivePerl is Perl written for Windows and other operating system for which traditional Perl is not written for. The main difference between ActivePerl and Perl, so far as coding is concerned, occurs at the start of the script. In Perl, you start a script with something like, #!/usr/bin/perl . With ActivePerl, this line is omitted. That is the main difference so far as coding is concerned.

    Requirements to test the Code Samples
    In order to test the code samples of the series, you need a web server and a browser. Most computers today have browsers, so you probably already have a browser. If you do not have access to a server, you can download a personal web server free from the Internet; just search the Internet to obtain one; look for one that works with ActivePerl.

    At the moment there are 3 parts to the series.

    The First Part of the Series
    The first part of the series explains how you can open and close a directory. Opening a directory here, means, you obtain a variable that you can use to access the content of the directory. This variable is called a Directory Handle. Closing a directory, means you put an end to the use of the directory handle to access the directory (content). All that is done in program code. The first part of the series also talks how you can read the names of the files and sub-directories in a directory.

    The Second Part of the Series
    This part of the tutorial series explains how to create and delete directories. In Perl, creating a directory is referred to as making a directory. Deleting a directory is referred to as removing a directory.

    The tutorial series have been written in a step-by-step fashion. The code samples are well formatted with good indentation, making them very readable. There is no missing special character, as you would find in some other sites. The hyperlinks to the different parts of the series are easily accessible from the different pages of the series. The tutorial series is free. Click the following link to start the series:

    Perl Directory Function Basics Tutorials