• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
Perl Programming for Biologists Spring, 2006Eric Rouchka 1 University of Louisville
Week 1: Perl Basics
What is Perl?
 
Perl stands for Practical Extraction and Report Language.
 
Perl is an interpreted programming language optimized for scanning arbitrary textfiles, extracting information from those text files, and printing reports based on thatinformation.
 
The string-based nature of DNA and protein sequence data makes Perl an obviouschoice for many of the simpler problems in computational biology.
How do I install Perl on my Computer?
Perl is an application, just like any other windows applications. It can be downloaded forfree for your use athttp://www.perl.com/ This is the main website for perl, and containsmany useful links.
Downloading Perl For Windows  
If you are using a windows-based computer, you should go to the active state web site(http://www.activestate.com/ 
 
) and download the latest version of ActivePerl, which isfreely available. As of this writing, the latest version is ActivePerl 5.8.7 build 815.Make sure to download the Windows MSI package. There are installation instructionson the ActiveState website as to how to install ActivePerl. You should just be able todownload the appropriate package and run it, and the installation should automaticallyoccur.
Perl for Other Operating Systems 
If you need the Mac version of Perl, you can go tohttp://www.macperl.com/ in order todownload Perl. Note that ActivePerl will now work on Macs as well!If you are using a Linux or Unix based operating system, then chances are great that Perlis already installed. To see if Perl is installed in Linux or Unix, type:
perl –v
If it is installed, you will get back a message giving you information concerning theversion you are using; otherwise, it will report back:
command not found
 
Perl Programming for Biologists Spring, 2006Eric Rouchka 2 University of Louisville
ActiveState Download Page.
Adding Perl to your path 
Installation of active state should automatically add Perl to your path. You can check thisby starting a command window (go to start->Run and type in “command”) and typing inthe word perl. If you get a message saying “command not found” then Perl is not in yourpath. Otherwise, Perl might start and be awaiting input from you (you can type ctrl-c toexit).If Perl is not in your path, you can add it by editing the file C:\autoexec.bat. Adding perlto your path will allow you to run perl by typing in only the command
perl
and not
D:\perl\bin\perl
. To do this, you need to do two things. First, make a backupcopy of the file
c:\autoexec.bat
. This can be done in the dos window by typing
cp c:\autoexec.bat c:\autoexec.bak
 
Perl Programming for Biologists Spring, 2006Eric Rouchka 3 University of Louisville
Now we need to edit the file
c:\autoexec.bat
file. This can either be done innotepad which can be found under Start-> Program->Accessories or by typing in thedos window:
edit c:\autoexec.bat
Now at the end of this file, add in the following line, substituting the correct locationof where Perl is installed. If you installed ActivePerl using the default locations, thenPerl is located in c:\Perl\Bin:
PATH=%PATH%;
PATH TO PERL GOES HERE 
;PATH=%PATH%;c:\perl\bin;
And
save autoexec.bat
. You may now need to reboot your computer for thesechanges to take effect. Note that you only need to do this step once.
Creating Perl Programs 
Perl programs can be created using any basic text editor, such as notepad. Perl programstypically end with a “.pl” extension. Make sure that if you are saving perl programs innotepad that you check it to save as all file types. Otherwise your perl programs willhave a .txt extension automatically added to them!
What is a Perl Program?
 
A program consists of a text file containing a series of Perl statements.
 
Perl statements are separated by a semi-colon.
 
Leading spaces on a line are ignored.
 
Multiple spaces, tabs, and blank lines are ignored.
 
Anything following # is ignored.
 
Perl is case sensitive.
Your First Perl Program
We will be starting with a simple program to get you started with learning what a Perlprogram looks like, and how it is created and run.
How do I edit or create a Perl Program? 
For now, you can use either notepad, edit, or any other simple text editor to create yourperl program. The editor you choose to use must save your files as plain text. Perl filesshould always be saved with a .pl extension at the end.
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...