Perl Programming Dr Claire Lambert

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Conditional statements and Boolean expressions. The if-statement in Java (1) The if-statement is a conditional statement The statement is executed only.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Scalar Variables Start the file with: #! /usr/bin/perl –w No spaces or newlines before the the #! “#!” is sometimes called a “shebang”. It is a signal.
VB .NET Programming Fundamentals
Chapter 3 Planning Your Solution
Data Structures and Programming.  John Edgar2.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Visual Basic Chapter 1 Mr. Wangler.
1 Perl Perl basics Perl Elements Arrays and Hashes Control statements Operators OOP in Perl.
Programming Lifecycle
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Input, Output, and Processing
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
The Software Development Process
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Introduction to Perl NICOLE VECERE. Background General Purpose Language ◦ Procedural, Functional, and Object-oriented Developed for text manipulation.
ERRORS. Types of errors: Syntax errors Logical errors.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Shell script – part 2 CS 302. Special shell variable $0.. $9  Positional parameters or command line arguments  For example, a script myscript take 2.
Perl Chapter 3 Conditional statements. Control Expressions Control expressions – interpreted as T/F (evaluated as strings or numbers) – simple, relational,
The full name of PERL is Practical extraction and report language. It is similar to shell script and lot easier & powerful language. Perl is free to download.
Wrapper Classes Debugging Interlude 1
Chapter VII: Arrays.
Visual Basic.NET Windows Programming
Topics Designing a Program Input, Processing, and Output
Working with Java.
Lecture 1 Introduction Richard Gesick.
Chapter 3 Syntax, Errors, and Debugging
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
Lecture 3: Operators, Expressions and Type Conversion
Chapter 2: Input, Processing, and Output
Testing and Debugging.
ICS103 Programming in C Lecture 3: Introduction to C (2)
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Microsoft Access Illustrated
Statements, Comments & Simple Arithmetic
Chapter 10 Programming Fundamentals with JavaScript
Problem Solving Techniques
Chapter 6 Variables What is VBScript?
Control Structures: if Conditional
Chapter 15 Debugging.
PROGRAMMING METHODOLOGY
Introduction to C++ Programming
Use of Mathematics using Technology (Maltlab)
Debugging 9/22/15 & 9/23/15 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1: Computer Systems
Control Structures: for & while Loops
Chapter 15 Debugging.
Learning Intention I will learn about evaluating a program.
Programming Fundamentals (750113) Ch1. Problem Solving
Software Development Process
Topics Designing a Program Input, Processing, and Output
Programming Fundamentals (750113) Ch1. Problem Solving
Topics Designing a Program Input, Processing, and Output
Chapter 2: Input, Processing, and Output
The Selection Structure
Review of Previous Lesson
DATA TYPES AND OPERATIONS
Chapter 15 Debugging.
INTRODUCTION to PERL PART 1.
Chapter 15 Debugging.
Presentation transcript:

Perl Programming Dr Claire Lambert MSc Bioinformatics Perl Programming Dr Claire Lambert

Data Types Scalars Arrays of scalars Associative arrays of scalars (hashes)

Literals Never changes - fixed number string array associative array

Variables Can change within the program number string array associative array

Operators Addition Subtraction Multiplication Division + or += - or -=

Logical operators AND OR NOT true AND true then true false OR false then false NOT changes state true becomes false false becomes true

Relational operators Equality Comparison Numeric Strings == , != eq , ne Comparison <, <=, >, >=, <=> lt, le, gt, ge, cmp

You should now be able to Setup appropriate data structures define different types and give examples illustrate operators that can be used write perl programs

Programming style Good programming principles correctness efficiency transparency, readability modifiablity robustness documentation

Programming style Importance of criteria depends on problem circumstances in which program is written environment in which program is to be used correctness has highest priority other criteria usually equal weight

Programming style Common mistake start writing immediately use stepwise refinement top down design top level - algorithm bottom level - primitive statements

Programming style Why conform to conventions? reduce risk of errors produce programs readable easy to understand easy to debug easy to modify or extend

Programming style Good style rules short statements procedures, functions, modules good naming of data objects layout for readability

Programming style Comments under-commenting over-commenting main purpose enable user to use program to understand program to modify program

Programming style Comments what program does? how it is run execution time and memory requirements limitations special system requirements functions and arguments implementation information

Programming style Efiiciency execution time space requirements improvements deeper understanding of problem better programming perl interpreter execution efficiency compilers are better at this

You should now be able to Describe good programming principles (criteria) the importance of the criteria identify common mistakes made explain why conform to style identify good rules of style why use comments, examples identify areas of efficiency

Debugging Debugging Debugger getting rid of errors syntax and logical Debugger tool to allow control when executing the program breakpoints print variable values

Debugging Syntax errors Common syntax errors compile-time errors error message generated Common syntax errors missing semi-colon string terminator “ errors not always on line specified errors may not be related to message generated

Debugging Logical errors Perl -w filename.pl Debugger bugs extra warnings unused variables (typo) variables used before they are set Debugger trace, breakpoints and actions print variable values

Debugging Strict forces declaration of variables does not allow mis-referencing

Debugging Debugger DB<1> a [line] ACTION b [line] L d [line] X variable s and n c [line]

You should now be able to Define what debugging is identify types of errors and common errors explain command line option -w use strict to force variable declaration use a debugger for a perl program