Introduction To Unix & Perl Programming 1 Bioinformatics: Issues And .

1y ago
4 Views
1 Downloads
580.05 KB
41 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Elisha Lemon
Transcription

Introduction to Unix& Perl Programming 1Bioinformatics:Issues and AlgorithmsCSE 308-408 Fall 2007 Lecture 4CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-1-

Administrative notes Homework #1 has been posted on Blackboard and is dueon Tuesday, Sept. 11 at 5:00 pm. Submit your work onlineusing the Blackboard Assignment function.CSE Department Distinguished Seminar SeriesTopic: “Architecture of Product Lines”Speaker: Dr. David M. Weiss, Avaya LaboratoriesLocation: Packard Lab 466Date: Thurs., Sept. 6, 4:00 pm – 5:00 pmReception @ 3:30 pm in Packard LobbyCSE Department Ice Cream Social (yum!)Location: Packard Lab 360Date: Tues., Sept. 11, 4:10 pm – 5:00 pmCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-2-

Programming environmentFor CSE 308-408, you may develop the programs for yourprogramming assignments using Perl on any platform.Most Linux installations generally include Perl (see discussionon page 17 of your BBP book).In particular, you can use machines in the CSE Dept. Sun Lab.These are accessible remotely from all over campus (andbeyond) using standard secure shell (ssh) client software.See: erever you develop your code, however, at the end of theday, you must make sure it runs on our systems.In addition, I will provide specific naming conventions tofacilitate the testing of your programs.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-3-

Secure shell (ssh) client on the Windows desktopCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-4-

Remote login procedure for the CSE Dept. Sun LabInitiate a secure shell (ssh) session to sunlab.cse.lehigh.edu,which provides a connection to a generally random machineamong all of the Suns.Since all of the Suns have unique ssh keys, you may find that,after your first connection, your client complains about changedkeys on the destination machine. You can either ignore thiscomplaint, or go directly to one of the Suns using its One TrueName (as displayed in its login prompt). The full list of Suns isdisplayed in the login motd on the machine named gateway.Our sys admins have confirmed that all students registered forCSE 308-408 have active accounts. If you have forgotten yourpassword, send email to help@cse.lehigh.edu.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-5-

Logging inCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-6-

Basic Unix commands you should knowFilesDirectoriesProcessesRunning PerlOtherls, more, cp, mv, rm, tail, catpwd, cd, mkdir, rmdirps, killperl (or /usr/bin/perl )w, finger, time, spellBut the single most important command is man. Typing:% man commandwill display a manual page for any Unix command (or function).Close behind in importance is apropos. Typing:% apropos keywordwill list all Unix commands that mention keyword.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-7-

Typing “man man” at the Unix shell promptUser Commandsman(1)NAMEman - find and display reference manual pagesSYNOPSISman [ - ] [ -adFlrt ] [ -M path ]-s section ] name .man [ -M path ] -k keyword .man [ -M path ] -f file .[ -T macro-package ][DESCRIPTIONThe man command displays information from the referencemanuals. It displays complete manual pages that you selectby name, or one-line summaries selected either by keyword(-k), or by the name of an associated file (-f). If nomanual page is located, man prints an error message.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-8-

Typing “man apropos” at the Unix shell promptUser Commandsapropos(1)NAMEapropos - locate commands by keyword lookupSYNOPSISapropos keyword .DESCRIPTIONThe apropos utility displays the man page name, sectionnumber, and a short description for each man page whose NAMEline contains keyword. . Each word is considered separatelyand the case of letters is ignored. Words which are part ofother words are considered; for example, when looking for compile', apropos finds all instances of compiler' also.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4-9-

Basic UNIX file commandsls list contents of current directoryls -l generate long listing with more detailsmore file page through file one screen at a timecp file1 file2 copy file1 to file2 (i.e., duplicate)mv file1 file2 move file1 to file2 (i.e., rename)rm file remove file (i.e., delete, erase)tail file display last lines in filecat file dump file to displaycat file1 file2 file3 concatenate file1 and file2 into file3Unix I/O redirectionCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 10 -

Basic UNIX directory commandspwd print working (current) directorycd dir change directory (down one level) to dircd . change directory up one levelmkdir dir create a new directory named dirrmdir dir remove directory dir (must be empty first)CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 11 -

Basic UNIX process commandspsps -fps -aps -Aps -A moreprints information about active processesgenerates full listing with more detailsprints information about all of your processesprints information about all processespages through processes one screen at a timeUnix pipekill PID kills active process with process ID PIDkill -9 PID kills active process PID “with extreme prejudice”CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 12 -

Other basic UNIX commandswfinger userIDtime commandspell filelist who is currently using machineprint details on a specific userreport time used to execute commandrun Unix spell checker on fileWait . aren't we missing one that's kind of important?perl file run Perl interpreter on source code fileCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 13 -

Let's get started writing code .You'll need a way to input andedit your program. Possiblechoices include vi and emacs.These have some advantagesbecause you can edit directlyin a terminal window.vi running in aterminal windowThe following online tutorials seem reasonable: http://www.eng.hawaii.edu/Tutor/vi.html http://www2.lib.uchicago.edu/ keith/tcl-course/emacs-tutorial.htmlCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 14 -

Let's get started writing code .A strategy to follow (but you'll develop your own preferences):One terminal windowopen for editing code .CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4. another terminal windowopen for running code.- 15 -

Let's get started writing code .You can also use an application like NotePad or WordPadrunning on a PC for editing, but you'll have to upload yourPerl code to a Unix machine to run it. *File transferwindow in sshEditing Perl codein Notepad* There are implementations of Perl available for Windows PC's, but rememberthat ultimately your code will have to run on the CSE Dept. Unix system.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 16 -

A simple Perl programprint "Welcome to the Wonderful World of Bioinformatics!\n";“\n” character sequence tellsPerl to display a new lineWhat will this do?Let's save it in a file named welcome and run it .umbria: /CSE308/Chapter3% perl welcomeWelcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 17 -

A less-simple Perl programprintprintprintprintprintprintprint"Welcome ";"to ";"the ";"Wonderful ";"World ";"of ";"Bioinformatics!\n";“;” (semicolon) character isstatement separator in PerlLet's save it in a file named welcome2 and run it .umbria: /CSE308/Chapter3% perl welcome2Welcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4Exactly same output as before!Simpler is better, however.- 18 -

Checking Perl syntaxEveryone makes mistakes from time-to-time.Perl has a way of checking whether or not your programcontains certain simple mistakes called “syntax errors”:print "Welcome to the Wonderful World of Bioinformatics!\n";umbria: /CSE308/Chapter3% perl -c welcomewelcome syntax OKumbria: /CSE308/Chapter3%“-c” stands for “check”Note: correct syntax does not mean no bugs!CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 19 -

Checking Perl syntaxNow consider:pint "Welcome to the Wonderful World of Bioinformatics!\n";umbria: /CSE308/Chapter3% perl -c welcomeString found where operator expected at welcome line 1, near"pint "Welcome to the Wonderful World of Bioinformatics!\n""(Do you need to predeclare pint?)syntax error at welcome line 1, near "pint "Welcome to theWonderful World of Bioinformatics!\n""welcome had compilation errors.umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4Useful information, onceyou learn to decipher it!- 20 -

More detailed source code checkingConsider program whoops:print ; "Welcome to the Wonderful World of Bioinformatics!\n";umbria: /CSE308/Chapter3% perl whoopsumbria: /CSE308/Chapter3%Whoops indeed – no output!umbria: /CSE308/Chapter3% perl -c whoopswhoops syntax OKThat didn't help .umbria: /CSE308/Chapter3%umbria: /CSE308/Chapter3% perl -c -w whoopsUseless use of a constant in void context at whoops line 1.whoops syntax OKCryptic, but better!“-w” asks for warnings.umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 21 -

More detailed source code checkingConsider program whoops:print ; "Welcome to the Wonderful World of Bioinformatics!\n";umbria: /CSE308/Chapter3% perl whoopsumbria: /CSE308/Chapter3%Really importantnote: even if yourprogram passes both of these tests, itumbria: /CSE308/Chapter3%might still have perlbugs!-c whoopswhoops syntaxIt isOKconsidered a fundamentalumbria: /CSE308/Chapter3%impossibility for static testing – no matterhow rigorous – to catch all bugs.umbria: /CSE308/Chapter3% perl -c -w whoopsEven so, it's a good idea to employ theUseless use“-c”of anda constantin voidcontextyourat whoops“-w” optionsto checkcode.whoops syntax OKumbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 22 -line 1.

Making code self-executingRecall:umbria: /CSE308/Chapter3% perl welcomeWelcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%Nicer if we could just type program name – call this welcome3:Location of Perl interpreter#! /usr/bin/perl -wprint "Welcome to the Wonderful World of Bioinformatics!\n";umbria: /CSE308/Chapter3% chmod u x welcome3umbria: /CSE308/Chapter3% welcome3Mark codeas executableWelcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 23 -

IterationIteration is a basic programming construct. We repeat thesame sequence of statements over and over until a prespecified condition is either satisfied or violated.while ( some condition is true ){do somethingPresumably something}happens here to makecondition false eventuallyCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 24 -

IterationIteration is a basic programming construct. We repeat thesame sequence of statements over and over until a prespecified condition is either satisfied or violated.Any line starting with“#” is a comment#! /usr/bin/perl -w# The 'forever' program - a (Perl) program,# which does not stop until someone presses Ctrl-C.use constant TRUEuse constant FALSEConstants provideuseful English names 1; 0;while ( TRUE )Executes so long as condition is true{print "Welcome to the Wonderful World of Bioinformatics!\n";sleep 1;}Program “sleeps” here for 1 secondCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 25 -

Getting caught in a loopSave previous program as forever , then:umbria: /CSE308/Chapter3% chmod u x foreverumbria: /CSE308/Chapter3% foreverWelcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics! CType “Ctrl-C” ( C) toumbria: /CSE308/Chapter3%killprocess and end infinte loopCSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 26 -

VariablesVariables are “containers” whose contents (values) can changeover lifetime of a program.In Perl, simpliest variable is a scalar , which holds single value.#! /usr/bin/perl -wVariable count set equal to 0# The 'tentimes' program - a (Perl) program,# which stops after ten iterations.use constant HOWMANY 10; count 0;False when count equals HOWMANYwhile ( count HOWMANY ){print "Welcome to the Wonderful World of Bioinformatics!\n"; count ;Variable count incremented}CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 27 -

A well-behaved loopSave previous program as tentimes , then:umbria: /CSE308/Chapter3% chmod u x tentimesumbria: /CSE308/Chapter3% tentimesWelcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 28 -

SelectionSelection is another basic programming construct that allowsprogram to take one path or another depending on condition.if ( some condition is true ){do something}The “else” clauseelseis optional{do something else}CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 29 -

A loop with selection#! /usr/bin/perl -w# The 'fivetimes' program - a (Perl) program,# which stops after five iterations.use constant TRUEuse constant FALSE 1; 0;use constant HOWMANY 5; count 0;Test for equality: note “ ” and not “ ”!while ( TRUE ){ count ;print "Welcome to the Wonderful World of Bioinformatics!\n";if ( count HOWMANY ){last;}Terminates current loop immediately}CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 30 -

A loop with selectionSave previous program as fivetimes , then:umbria: /CSE308/Chapter3% chmod u x fivetimesumbria: /CSE308/Chapter3% fivetimesWelcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!Welcome to the Wonderful World of Bioinformatics!umbria: /CSE308/Chapter3%Which style of loop is better, tentimes or fivetimes ?Your BBP textbook offers the helpful maxim:There's more than one way to do it.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 31 -

Checking parity of an integer ('odd' vs. 'even')#! /usr/bin/perl -wuse constant HOWMANY count 0; 4;while ( count HOWMANY ){ count ;if ( count 1 )While this works, it seems kind of{print "odd\n";awkward and not very general.}elsif ( count 2 )(What happens if we want to do{print "even\n";this for a large number of values?)}elsif ( count 3 ){print "odd\n";}else# at this point count is four.{print "even\n";}}CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 32 -

More than one way to do it .While it's true “there's more than one way to do it,” some waysare definitely better than other ways. Case in point:#! /usr/bin/perl -w# The 'terrible' program - a poorly formatted 'oddeven'.use constant HOWMANY 4; count 0;while ( count HOWMANY ) { count ;if ( count 1) { print "odd\n"; } elsif ( count 2 ){ print "even\n"; } elsif ( count 3 ) { print "odd\n"; }else# at this point count is four.{ print "even\n"; } }This program works, but it is very hard to understand.metis: /CSE308/Chapter3% terribleoddMoral: make your programs easyevenoddto read by using whitespace andevengood formatting style.metis: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 33 -

A better parity checking program .Both oddeven and terrible reflect poor style. This is better:#! /usr/bin/perl -wuse constant HOWMANY count 0; 4;Modulo arithmetic operator (%)returns remainder of division.When divisor is 2, remainder is0 if integer is even and 1 if odd.while ( count HOWMANY ){ count ;if ( count % 2 0){print "even\n";}else# count % 2 is not zero.{print "odd\n";}}Moral: in general, aim for generality. :-)CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 34 -

A (slightly) better parity checking program .Even better, perhaps, because it is more succinct:#! /usr/bin/perl -w# The 'oddeven3' program - yet another version of 'oddeven'.use constant HOWMANY 4; count 0;while ( count HOWMANY ){ count ;print "even\n" if ( count % 2 0 );print "odd\n" if ( count % 2 ! 0 );}This form of conditional statement is rarelyfound in other languages, but is very handy!(Perl calls it a “statement qualifier.”)CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 35 -

Processing inputWe can't do much unless we can get data into our programs.#! /usr/bin/perl -w# The 'getlines' program which processes lines.while ( line ){print line;}metis: /CSE308/Chapter3% getlinesHello, Lehigh!What I typed on keyboardHello, Lehigh!Are we having fun yet?Output from programAre we having fun yet?Hey, stop doing that!!!Hey, stop doing that!!!Type “Ctrl-D” ( D) for “end-of-file”metis: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 36 -

Taking input from a fileUnder Unix, input can easily come from file or from keyboard:#! /usr/bin/perl -wwhile ( line ){print line;}Directs getlines to take itsinput from the file terriblemetis: /CSE308/Chapter3% getlines terrible#! /usr/bin/perl -w# The 'terrible' program - a poorly formatted 'oddeven'.use constant HOWMANY 4; count 0;while ( count HOWMANY ) { count ;if ( count 1) { print "odd\n"; } elsif ( count 2 ){ print "even\n"; } elsif ( count 3 ) { print "odd\n"; }else# at this point count is four.{ print "even\n"; } }metis: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 37 -

Pattern matchingAs noted earlier, pattern matching is a very important feature ofPerl for bioinformatics applications. We'll consider this in moredetail later, but for now, let's look at a simple example.“ ” is known as the“binding operator” in Perl#! /usr/bin/perl -w# The 'patterns' program - introducing regular expressions.while ( line ){print line if line /even/;}“Print the contents of the scalar variable lineif and only if it contains the pattern 'even'”CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 38 -

Pattern matching#! /usr/bin/perl -wNote: patterns tell perl whatto look for, not how to do it.while ( line ){print line if line /even/;}metis: /CSE308/Chapter3% patterns terrible# The 'terrible' program - a poorly formatted 'oddeven'.{ print "even\n"; } elsif ( count 3 ) { print "odd\n"; }{ print "even\n"; } }Only lines containing themetis: /CSE308/Chapter3%string “even” get printedmetis: /CSE308/Chapter3% patterns oddeven# The 'oddeven' program - a (Perl) program,# is an odd number, and 'even' when count is an evenprint "even\n";print "even\n";metis: /CSE308/Chapter3%CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 39 -

Maxims from BBP Chapter 3Your book provides short summaries of key points (“maxims”): Programs execute in sequential order. Less is better (in general). There's more than one way to do it. Add comments to facilitate future code maintenance. Use human-friendly names for constants and variables. A condition results in a “true” or “false” value. For readability, use plenty of whitespace and good formatting. Patterns tell perl what to look for, not how to do it.CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 40 -

Wrap-upReadings for next time: BB&P Chapters 4-5 (more Perl programming).Remember: Come to class having done the readings. Check Blackboard regularly for updates. If enrolled in CSE 408, let me know which lecture topic youwish to scribe by Friday, Sept. 7. (Send me several choices.)CSE 308-408 · Bioinformatics: Issues and AlgorithmsLopresti · Fall 2007 · Lecture 4- 41 -

Running Perl perl (or /usr/bin/perl) Other w, finger, time, spell Close behind in importance is apropos. Typing: % apropos keyword will list all Unix commands that mention keyword. But the single most important command is man. Typing: % man command will display a manual page for any Unix command (or function).

Related Documents:

Why Perl? Perl is built around regular expressions -REs are good for string processing -Therefore Perl is a good scripting language -Perl is especially popular for CGI scripts Perl makes full use of the power of UNIX Short Perl programs can be very short -"Perl is designed to make the easy jobs easy,

Perl can be embedded into web servers to speed up processing by as much as 2000%. Perl's mod_perl allows the Apache web server to embed a Perl interpreter. Perl's DBI package makes web-database integration easy. Perl is Interpreted Perl is an interpreted language, which means that your code can be run as is, without a

Run Perl Script Option 3: Create a Perl script my_script.pl: Run my_script.pl by calling perl: 8/31/2017 Introduction to Perl Basics I 10 print Hello World!\n; perl ./my_script.pl Option 4: For a small script with several lines, you can run it directly on the command line: perl -e print Hello World!\n;

Run Perl Script Option 3: Create a Perl script my_script.pl: Run my_script.pl by calling perl: 8/31/2017 Introduction to Perl Basics I 10 print Hello World!\n; perl ./my_script.pl Option 4: For a small script with several lines, you can run it directly on the command line: perl -e print Hello World!\n;

Introduction to Perl Pinkhas Nisanov. Perl culture Perl - Practical Extraction and Report Language Perl 1.0 released December 18, 1987 by Larry Wall. Perl culture Perl Poems BEFOREHAND: close door, each window & exit; wait until time. open spellbook, study, read (scan, select, tell us);

Other Perl resources from O’Reilly Related titles Learning Perl Programming Perl Advanced Perl Programming Perl Best Practices Perl Testing: A Developer’s . Intermedi

Perl's creator, Larry Wall, announced it the next day in his State of the Onion address. Most notably, he said "Perl 6 is going to be designed by the community." Everyone thought that Perl 6 would be the version after the just-released Perl v5.6. That didn't happen, but that's why "Perl" was in the name "Perl 6."

tutorial Sorry about that but I have to keep my tutorial's example scripts short and to the point Finally, this is a tutorial for Perl/Tk only I will not be teaching perl here So if you know perl, continue But if you are a beginner to perl, I would recommend that you read my perl tutorial