perl part 1

30
Perl part 1

Upload: aspen

Post on 13-Jan-2016

45 views

Category:

Documents


0 download

DESCRIPTION

Perl part 1. What is perl?. Why perl ?. Good for bioinformatics and web programming Suit for all the operating systems Suit for all kinds of computer Ease of Programming Rapid Prototyping Portability, Speed, and Program Maintenance. Versions of Perl. Perl Version 5 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Perl  part 1

Perl part 1

Page 2: Perl  part 1

What is perl?

Page 3: Perl  part 1

Why perl?• Good for bioinformatics and web

programming

• Suit for all the operating systems

• Suit for all kinds of computer

• Ease of Programming

• Rapid Prototyping

• Portability, Speed, and Program Maintenance

Page 4: Perl  part 1

Versions of Perl

• Perl Version 5

• The current version of Perl is 5.8.8.

• Perl Version 6 in progress

Page 5: Perl  part 1

Installing Perl on Your Computer

• $ perl -v

• Downloading Unix,Linux:http://www.perl.com/download.csp

• Perl for Win32 --http://www.activestate.com/ActivePerl/

Page 6: Perl  part 1

How to Run Perl Programs

• Windows : typing this_program in an MS-DOS comm

and window or by typing perl this_program.pl.

Linux: make the program executable using the ch

mod program :chmod 755 this_program ORperl /usr/local/bin/this_program

Page 7: Perl  part 1

Text Editors

• Linux :vi and emacs

• Windows:Notepad ;word;

Page 8: Perl  part 1

Good start for Programming

• Take classes of many different kinds• Read a tutorial book like this one• Get the programming manuals and plunge in• Be tutored by a programmer• Identify a program you need• Try any and all of the above until you've manage

d to write the program • Edit—Run—Revise (and Save)

Page 9: Perl  part 1

Scalar Data

• A scalar is the simplest kind of data that Perl manipulates. Most scalars are a number (like 255 or 3.25e20) or a string of characters (like hello[ ] or the Gettysburg Address).

Page 10: Perl  part 1

Numbers

• Floating-Point Literals

• Integer Literals

• Non-Decimal Integer Literals

Page 11: Perl  part 1
Page 12: Perl  part 1

Numeric Operators

Page 13: Perl  part 1

Strings

• Strings are sequences of characters (like hello). Strings may contain any combination of any characters.The shortest possible string has no characters. The longest string fills all of your available memory.

Page 14: Perl  part 1

Single-Quoted String Literals A single-quoted string literal is a sequence of characters enclosed in single quotes. The single quotes are not part of the string itself but are there to let Perl identify the beginning and the ending of the string.

Page 15: Perl  part 1

Double-Quoted String Literals

• A double-quoted string literal is similar to single-quoted string literal , But now the backslash takes on its full power to specify certain control characters or any character through octal and hex representations.

Page 16: Perl  part 1
Page 17: Perl  part 1

String Operators

Page 18: Perl  part 1

Automatic Conversion Between Numbers and Strings

• Check the operator

Page 19: Perl  part 1

Perl's Built-in Warnings

• -w option

• $ perl -w my_program

• #!/usr/bin/perl -w

Page 20: Perl  part 1

Scalar Variables

• A variable is a name for a container that holds one or more values

• A scalar variable holds a single scalar value as you'd expect. Scalar variable names begin with a dollar sign $

• can't start with a digit

Page 21: Perl  part 1

Scalar Assignment

• The most common operation on a scalar variable is assignment, which is the way to give a value to a variable. The Perl assignment operator is the equals sign = (much like other languages), which takes a variable name on the left side and gives it the value of the expression on the right:

Page 22: Perl  part 1

Binary Assignment Operators

Page 23: Perl  part 1

Output with print

Page 24: Perl  part 1
Page 25: Perl  part 1
Page 26: Perl  part 1
Page 27: Perl  part 1

Lists and Arrays

• A list is an ordered collection of scalars. An array is a variable that contains a list.

Page 28: Perl  part 1

List Literals

Page 29: Perl  part 1

• sign (@) before the name of the array

Page 30: Perl  part 1