Scripting Languages ● Perl, Python, Unix Shell, VB, JavaScript, etc. ● Glue Languages. ● Typeless. ● Interchangeable Code and Data. ● Interpreted vs. Compiled.

Slides:



Advertisements
Similar presentations
Perl Practical Extration and Reporting Language An Introduction by Shwen Ho.
Advertisements

1/12 Steven Leung Very Basic Perl Tricks A Few Ground Rules File I/O and Formatting Operators, Flow Control Statements Regular Expression Subroutines Hash.
A Guide to Unix Using Linux Fourth Edition
● Perl reference
CS 330 Programming Languages 09 / 27 / 2007 Instructor: Michael Eckmann.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
CSET4100 – Fall 2009 Perl Introduction Scalar Data, Operators & Control Blocks Acknowledgements: Slides adapted from NYU Computer Science course on UNIX.
CS 898N – Advanced World Wide Web Technologies Lecture 8: PERL Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Introduction to Perl. How to run perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Your program/script.
Guide To UNIX Using Linux Third Edition
Shell Programming 1. Understanding Unix shell programming language: A. It has features of high-level languages. B. Convenient to do the programming. C.
Unix Shell Scripts. What are scripts ? Text files in certain format that are run by another program Examples: –Perl –Javascript –Shell scripts (we learn.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
1 Perl Perl basics Perl Elements Arrays and Hashes Control statements Operators OOP in Perl.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines Lab.
Computer Science 111 Fundamentals of Programming I Overview of Programming.
Control Structures. Important Semantic Difference In all of these loops we are going to discuss, the braces are ALWAYS REQUIRED. Even if your loop/block.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
CSC 352– Unix Programming, Spring 2015 March 2015 Shell Programming (Highlights only)
Meet Perl, Part 2 Flow of Control and I/O. Perl Statements Lots of different ways to write similar statements –Can make your code look more like natural.
Perl Practical(?)‏ Extraction and Report Language.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Control Structures. if-elsif-else semantically the same as C/C++ syntactically, slightly different. if ($a > 0){ print “\$a is positive\n”; } elsif ($a.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Introduction to Perl Yupu Liang cbio at MSKCC
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Perl: Lecture 1 The language. What Perl is Merger of Unix tools – Very popular under UNIX – shell, sed, awk Programming language – C syntax Scripting.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
Chapter 10: BASH Shell Scripting Fun with fi. In this chapter … Control structures File descriptors Variables.
CS 330 Programming Languages 09 / 28 / 2006 Instructor: Michael Eckmann.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
Introduction to Perl “Practical Extraction and Report Language” “Pathologically Eclectic Rubbish Lister”
Writing Scripts Hadi Otrok COEN 346.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
Chapter 11: Perl Scripting Off Larry’s Wall. In this chapter … Background Terminology Syntax Variables Control Structures File Manipulation Regular Expressions.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
CS 105 Perl: Basic I/O, Context, Strings, Lists Nathan Clement January 22, 2014.
Getting started in Perl: Intro to Perl for programmers Matthew Heusser – xndev.com - Presented to the West Michigan Perl User’s Group.
Introduction to Perl October 4, 2004 Class Meeting 7 * Notes on Perl by Lenwood Heath, Virginia Tech © 2004.
TCL TK. Tcl/Tk C functions can become Tcl commands that are invoked interactively Tk = scriptable, portable user interface –Windows, X (Unix), MacOS,
Topic 2: Working with scalars CSE2395/CSE3395 Perl Programming Learning Perl 3rd edition chapter 2, pages 19-38, Programming Perl 3rd edition chapter.
Introduction to Perl NICOLE VECERE. Background General Purpose Language ◦ Procedural, Functional, and Object-oriented Developed for text manipulation.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Computer Programming for Biologists Class 4 Nov 14 th, 2014 Karsten Hokamp
PERL By C. Shing ITEC Dept Radford University. Objectives Understand the history Understand constants and variables Understand operators Understand control.
CSI605 perl. Perl Facts Perl = Pathologically Eclectic Rubbish Lister Perl is highly portable across many different platforms and operating systems Perl.
Perl Chapter 3 Conditional statements. Control Expressions Control expressions – interpreted as T/F (evaluated as strings or numbers) – simple, relational,
The Scripting Programming Language
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
Unit – 3 Control structures. Condition Statements 1.If.…..else :- Has someone ever told you, "if you work hard, then you will succeed"? And what happens.
Perl Ed Finegan. Overview of Pearl Perl is a high-level programming language written by Larry Wall. It derives from the C programming language and to.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
COMP075 OS2 Bash Scripting. Scripting? BASH provides access to OS functions, like any OS shell Also like any OS shell, BASH includes the ability to write.
Fundamentals of Programming I Overview of Programming
CSC 352– Unix Programming, Spring 2016, Final Exam Guide
CSC 352– Unix Programming, Fall 2012
Perl Programming Language Design and Implementation (4th Edition)
What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:
Control Structures: if Conditional
Control Structures: for & while Loops
CSC 352– Unix Programming, Fall, 2011
INTRODUCTION to PERL PART 1.
Karan Thaker CS 265 Section 001
Presentation transcript:

Scripting Languages ● Perl, Python, Unix Shell, VB, JavaScript, etc. ● Glue Languages. ● Typeless. ● Interchangeable Code and Data. ● Interpreted vs. Compiled. ● Rapid Prototyping and short development time. ● Sacrifice execution speed. ● Symbiotic with system programming languages.

Rise in importance ● GUIs, Internet, Component frameworks ● Advance in scripting technology (JCL -> Perl) ● Machine speeds are rising (2x every 18 months) ● Change in programming community Arguments for and against are common: So, lets re-enact this over the mailing list !

Perl ● Initially designed as a glue for Unix. ● A text processor. ● Free, simple, flexible and loaded with features. ● Compiled and Interpreted.

Singulars and Plurals ● Scalars $ident holds a single value. ● keyed by number ● Hash%identunordered, keyed by string ● Subroutine&identCallable chunk of code ● Typeglob*ident anything!

$mynum = 45; $realnum = ; $scinum = 3.44e2; $mystr = “string”; $inter = “interpolated $mystr”; $noint = 'no interpolation with $mystr'; $expr = $realnum * $scinum; $stroutput = `ls`; print '123' + 1, “\n”; 124 print '123' + 1, '\n'; 124\n

= (“one”, “two”, “three”); $nums[0] = “one”; $nums[1] = “two”; $nums[2] = “three”; ($num1, $num2, $num3) rearranged order ($n1, $n2, $n3) = ($num2, $num3,$num1);

Hashes %daysof week = (“Sun”, “Sunday”, “Mon”, “Monday”,..., “Sat”, “Saturday”); %daysof week = ( “Sun” => “Sunday”, “Mon” => “Monday”,..., “Sat” => “Saturday”); $longday{“Tue”} = “Tuesday”;

Functions ● Subroutines, operators, procedures. ● They all return a value. ● print “123” returns 1 ● print nothing returns an undefined value.

Filehandles open(OLDFILE,"try"); open(OLDFILE, “<try”); open(NEWFILE, “>newtry”); open(OLDFILE, “>>newtry”); open(PIPE, “| output-pipe”); open(PIPE, “input-pipe |”); STDIN, STDOUT, STDERR have their usual meanings. Typical user input operation. chop($number = );

Operators ● Arithmetic+, -, /, *, %, ** ● String., x, ● Assignment =, op= (lvalue op= rvalue) ● AutoIncr/decr++$a, $a++, --$a, $a-- ● Logical &&, ||, !, and, or, not ● Comparison ==(eq), != (ne), (gt), (cmp) ● File test -d, -e, -r,....(mostly unary and return boolean)

Truth ● Any string except “” and “0”.\ ● Any number except 0. ● Any reference. (evaluates to non zero address) ● No undefined value. (evaluates to 0 or null str.)

Control Structures – if and unless if (boolean) {... }; if (boolean) {... } else {... }; if (boolean) {... } elsif (boolean) {... } else {... }; unless(boolean) {... }; equivalent to if (not(boolean)) {... };

Control Structures – while and until while (boolean) {... }; until (boolean) {... }; same as while(not(boolean)) {... };

Control Structures – for and foreach for (initialization; terminating condition, step) {... }; foreach $scalar {... } next and last are very similar to C continue and break except for ability to handle multilevel exits. LABEL : while (boolean){ { {... last LABEL if (boolean);...} next LABEL if (boolean); }}