Introductory Perl

From irefindex
(Redirected from MBV3070)

This introduction to Perl is taught as part of MBV-INF4410/9410 and MBV3070.

Slides for the "Introduction to Perl" lectures:

Command Prompt and Notepad

The command window or "Command Prompt" is found by opening the "Start" menu, choosing "Programs", then "Accessories", and then selecting "Command Prompt".

When you start the Command Prompt, you will be able to look at the contents of a particular folder or directory, and the commands you use will do their work within that folder. The folder you start in will probably be your home folder.

Notepad is found in the same menu, but it can be easier to open Notepad by typing the notepad command in the Command Prompt window like this:

notepad example1.plx

This makes sure that the new file is created in the right place. In this case, it is called example1.plx. If you started Notepad from the menu, when you save the file you have to find your way to where your programs need to be stored, and that can take some time.

DOS Commands

The Command Prompt uses a different set of commands to those you find in Perl: these commands are known as DOS commands.

You will need to know how to make your way around in a DOS command environment. Useful sites that may be useful to read before/during the exercises are:

Especially these:

dir Shows the contents of the current directory (folder)
mkdir name Makes a new directory called name
cd name Enters the directory called name
cd .. Goes up and out of the current directory
copy source target Makes a copy of source with the name target, or makes a copy of source with the same name inside a directory called target (if present)
move source target Moves source inside a directory called target (if present)
rename oldname newname Renames oldname to newname
del name Deletes the file called name (be careful!)
cls Clears the console/terminal
echo %PATH% Shows the list of places where the system looks for programs
Ctrl+C (holding down Ctrl and C) Terminate a program - useful if you have accidentally programmed an infinite loop that you want to stop

Unix Commands

If you are using GNU/Linux or Mac OS X, you will be using different commands:

ls Shows the contents of the current directory (folder)
mkdir name Makes a new directory called name
cd name Enters the directory called name
cd .. Goes up and out of the current directory
cd Goes to your home directory
cp source target Makes a copy of source with the name target, or makes a copy of source with the same name inside a directory called target (if present)
mv source target Renames source to target, or moves source inside a directory called target (if present)
rm name Deletes the file called name (be careful!)
clear Clears the console/terminal
echo $PATH Shows the list of places where the system looks for programs
Ctrl+C (holding down Ctrl and C) Terminate a program - useful if you have accidentally programmed an infinite loop that you want to stop