MIE453 - Bioinformatics Systems (Fall 06)
Tutorial 1 - Introduction to Perl
Contents
- Introduction to Perl
- Writing and Running Perl Scripts at ECF
- Installing Perl Interpreter on your computer
- Example Scripts
1. Introduction to Perl
What is Perl
- Practical Extraction and Report Language, written by Larry Wall
in 1987
- originated as a report-generation language, designed to aid system administrators
Benefits of Perl
- open source, platform (OS) independent
- Perl interpreter preinstalled on all UNIX/Linux systems
- also available on virtually all systems (Windows, Mac OS)
- high portability
- e.g., Perl scripts written on Mac, can be executed on Windows without
or with only minor retrofitting
- extensible, rich set of libraries
- extremely popular in bioinformatics
- great for text manipulation
- many Perl-based bioinformatics resources
Versions of Perl
- We will use Perl versio 5 or higher
- On Unix / Linux, type following at a command prompt to check the version
of your Perl
Programming in Perl
- Perl is a scripting language
- Perl scripts are interpreted text files
- each line in the script is interpreted and executed at run-time
Perl Resources on the Web
2. Writing and Running Perl Scripts at ECF
Running Perl Scripts
- Perl has already been installed at ECF
- to run Perl scripts from command line, type
- another way
- find out the pathname where Perl is install on your system
- add the directive "#!/local/bin/perl"
at the beginning of your Perl script (command interpretation)
- make your script executable
- run the script directly (e.g., myscript.pl)
Writing Perl Scripts
- any text editor availabe at ECF will do
- simple editors such as pico, xedit, nedit, gedit, kedit
- or more powerful ones such as vi, emacs
- The convention is to save Perl programs with a ˇ°.plˇ± extension (e.g.
myscript.pl)
Your First Perl Script - Hello World (t1-1.pl)
# my first perl script
print ˇ°Hello World\nˇ±;
|
3 Running Perl on your computer
Connect to ECF remotely
Emulate Unix on Windows
Install Perl interpreter on your computer
- ActivePerl - Perl distribution on Unix, Linux, MAC OS, Windows
- Free download at http://www.activestate.com/Products/ActivePerl/
- For Windows, choose Windows MSI package
- After installation, run Perl script at command prompt as usual (e.g., perl
myscript.pl)
4 Example Scripts
These perl scripts are adopted from the book Beginning Perl for
Bioinformatics, James Tisdall, ISBN, 0-596-00080-4, 2001.