Perl, Object Orientation

Size: px
Start display at page:

Download "Perl, Object Orientation"

Transcription

1 Perl, Object Orientation (and a little Graph Theory) Nick Stylianou nickstylianou@yahoo.co.uk 1

2 Outline Preliminaries (History, Resources) 1) The Perl Language 2) Object-Orientation (OO) in Perl 3) Example Application: Graph Theory Conclusions, Questions & Discussion 2

3 A Brief History of Perl Created by Larry Wall Natural and Artificial Languages, Seattle Pacific University (1970s) NASA JPL, System Development Corporation (SDC) Unisys (1986) Perl v1.0 released in 1987 Perl v5.0 released in 1994 Perl Free Software Foundation Award 1998 for the Advancement of Free Software v5.6 (2000) Unicode, 64-bit, standardised version numbering v5.8 (2002) Unicode, I/O, Threads, widely distributed Current stable production version 5.24 (2016) Perl 6 specification proposed in 2000 redesign, not backwards-compatible; implementations (Pugs, Rakudo) 3

4 Resources 4

5 Download 5

6 Documentation 6

7 Community 7

8 Add-On Modules 8

9 1) The Perl Language Hello world! & the Perl philosophy Data Structures Primitive Data Types and Common Code Patterns References (Pointers) Modularity Subroutines and Packages 9

10 Hello world & the Perl philosophy print Howdy, world!\n that s it!!! (p. 1) Perl is designed to make the easy jobs easy, without making the hard jobs impossible. (p. ix) With Perl you re free to do The Right Thing, however you care to define it. (p. 1) If you re starting to get the feeling that much of Perl culture is governed by mere convention, then you re starting to get the right feeling... (p. 278) The Camel Book Larry Wall et al., Programming Perl (1996) 10

11 Best Practice Hello world helloworld.pl #!/usr/bin/perl #!/usr/bin/perl v5.10; v5.10; strict; strict; warnings; warnings; print print "Hello "Hello world!\n"; world!\n"; exit exit 0; 0; 11

12 Data Structures: Primitive Data Types Scalars $a = 3; $price = 5.8; print $a; # prints 3 $c = orange ; Arrays = (10,20,30,40, banana ); $a[5] = 60; print $a[0]; # prints = (20,30,40) Hashes key value %price = ( espresso => 1.8, latte => 2.0 ); $price{tea} = 1.5; print $price{espresso}; # prints

13 Common Code Patterns: Arrays ($x,$y,$z) = (0,0,0); # $x=0; $y=0; $z=0; ($a,$b) = ($b,$a); # swaps values of $a and = for ( $i=0; $i <= $#a; for ( $i=0; $i < $i++) { $a[$i]++; } $i++) { $a[$i]++; } foreach $e (@a) { $e++; } $x = $y; # stack $x = $y; # queue The of is encouraged for strict lexical scoping strict 13

14 Common Code Patterns: Hashes foreach $k (keys %price) { $price{$k}*=1.2; } foreach $k (sort keys %price) { print } Take care with quotes: $price{latte} $price{ latte } $price{ latte } $price{$k} $price{ $k } $price{ $k } defined and exists : $hash{key} = undef; delete $hash{key}; value defined $hash{key} key exists $hash{key} 14

15 Compound Data Structures Arrays of Arrays (multi-dimensional foreach $t (0..9) { foreach $u (0..9) { $a[$t][$u] = (10*$t)+$u; } } print $a[5][3]; # prints 53 u t Hashes of Hashes (nested hashes): %h=(); foreach $y ( a, b, c, d ) { foreach $x ( r, g, b ) { $h{$y}{$x} = $y$x ; } } print $h{ c }{ r }; # prints cr x r g b a ar ag ab y b br bg bb c cr cg cb d dr dg db 15

16 References (Pointers) Obtain a (hard) reference with the \ operator $s = r ; $p = = (); $q = \@a; %h = (); $r = \%h; De-reference with { } $t = %g = %{$r}; $t = $$p; (soft ref) $u = $a[0]; $u = ${$q}[0]; $v = $h{key}; $v = ${$r}{key}; or the -> operator: $u = $q->[0]; $v = $r->{key}; 16

17 More References Compound Arrays and Hashes $a[5][3] $a[5]->[3] $h{c}{r} $h{c}->{r} Anonymous Arrays and $a=[]; $a[0] = x ; $a->[0] = x ; %h=(); $h={}; $h{key} = 1; $h->{key} = 1; 17

18 Modularity: Subroutines A routine (function) is a named code block It returns the value of the last evaluated statement the return statement makes this explicit Arguments are passed in as the call-by-reference vs call-by-value (shift, is a single flattened array to maintain identities of distinct arrays, references 18

19 Subroutine Example ($a,$b) = (1,2); # # 2 arrays foo($a,$b,@a,@b); # adds the sum of first two args to # each of the remaining args foo { ($x,$y) = shift); foreach $e (@_) { $e += $x+$y; } } 19

20 Packages Basic Structure MyLib.pm package package MyLib; MyLib; 1; 1; identify identify print print "MyLib\n"; "MyLib\n"; app.pl MyLib; MyLib; MyLib::identify(); MyLib::identify(); 20

21 The Perl Language Recap 3 Primitive Data Types Code Patterns Compound Data Structures References Subroutines Packages scalars $, arrays [ ], hashes % { } => for/foreach, push/shift, keys %h, quotes, defined / exists arrays of arrays, hashes of hashes \, %{$r} ->, anonymous arrays/hashes: $a=[ ] $h={}, (flattened list), call by reference / value package,, :: 21

22 2) Object Orientation in Perl Constructors Composition Attributes Inheritance Methods Abstraction Initialisation OO Frameworks 22

23 Constructors app.pl MyClass.pm package package MyClass; MyClass; 1; 1; MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); ## MyClass->new(); MyClass->new(); ## MyClass::new(MyClass::); MyClass::new(MyClass::); new new $class $class == shift; shift; $self $self == {}; {}; return return $self; $self; 23

24 Attributes MyClass.pm app.pl package package MyClass; MyClass; MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); 1; 1; new new $class $class == shift; shift; $self $self == {}; {}; $self->{id} $self->{id} == 1; 1; return return $self; $self; printf printf %d\n, %d\n, $instance->{id}; $instance->{id}; 24

25 Methods: Aessors app.pl MyClass.pm new new $class $class == shift; shift; $self $self == {}; {}; $self->{id}=1; $self->{id}=1; return return $self; $self; MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); printf printf %d\n, %d\n, $instance->getid(); $instance->getid(); getid getid $self=shift; $self=shift; return return $self->{id}; $self->{id}; 25

26 Methods: Modifiers app.pl MyClass.pm new new $class $class == shift; shift; $self $self == {}; {}; $self->setid(1); $self->setid(1); return return $self; $self; getid getid setid setid MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); $instance->setid(5); $instance->setid(5); printf printf %d\n, %d\n, $instance->getid(); $instance->getid(); $self=shift; $self=shift; $self=shift; $self=shift; return return $self->{id}; $self->{id}; $self->{id}=shift; $self->{id}=shift; 26

27 Methods: Combined app.pl MyClass.pm MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); new new $class $class == shift; shift; $self $self == {}; {}; $self->id(1); $self->id(1); return return $self; $self; $instance->id(5); $instance->id(5); printf printf %d\n, %d\n, $instance->id; $instance->id; id id ## multi-purpose multi-purpose aessor/modifier aessor/modifier $self=shift; $self=shift; return return $self->{id}=shift $self->{id}=shift :: $self->{id} $self->{id} ;; 27

28 Initialisation MyClass.pm app.pl new new $class $class == shift; shift; $self $self == {}; {}; $self->_init(); $self->_init(); return return $self; $self; MyClass; MyClass; $instance $instance == new new MyClass(); MyClass(); $instance->id(5); $instance->id(5); printf printf %d\n, %d\n, $instance->id; $instance->id; _init _init $self $self == shift; shift; $self->id(1); $self->id(1); underscore indicates private method by convention only 28

29 Parameterised Initialisation app.pl MyClass.pm MyClass; MyClass; new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; $instance $instance == new new MyClass( MyClass( id id => => 55 ); ); printf printf %d\n, %d\n, $instance->id; $instance->id; _init _init ($self,%param) $self->id( $self->id( (exists (exists $param{id}) $param{id})?? $param{id} $param{id} :: 11 ); ); 29

30 Object-Orientation Recap1 Constructors: A class is a package with a constructor routine ( new ) An instance is a reference to a blessed anonymous hash Attributes are the key-value pairs of this hash Methods are additional routines ( invoked with -> ): Aess/Modify attributes (combined) distinction: instance methods ($self), class methods ($class) notion of private methods by convention only ( _ prefix ) Initialisation Separate from construction Parameterised initialisation (using key-value pairs) 30

31 Composition: Objects within Objects app.pl MyClass; MyClass; MyOtherclass; MyOtherclass; $instance $instance == new new MyClass( MyClass( id => 5, id => 5, part part => => new new MyOtherclass( MyOtherclass( index index => => 11 )) ); ); MyClass.pm printf printf %d\n, %d\n, $instance->part->index; $instance->part->index; _init _init ($self,%param) ($self,%param) $self->part( $self->part( (exists (exists $param{part}) $param{part})?? $param{part} $param{part} :: new new MyOtherclass() MyOtherclass() ); ); part part ## multi-purpose multi-purpose aessor/modifier aessor/modifier $self=shift; $self=shift; return return (@_) (@_)?? $self->{part}=shift $self->{part}=shift :: $self->{part} $self->{part} ;; 33

32 Inheritance (almost!) package package MySubclass; MySubclass; parent parent 'MyClass'; 'MyClass'; package package MyClass; MyClass; new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; _init _init ($self,%param) $self->id( $param{id} $self->id( $param{id} ); ); new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; MyClass; MyClass; MySubclass; MySubclass; $v $v == new new MyClass( ); MyClass( ); $n $n == new new MySubclass( ); MySubclass( ); _init _init ($self,%param) $self->name( $param{name} $self->name( $param{name} ); ); but id isn t initialised!!! 34

33 Inheritance package package MySubclass; MySubclass; parent parent 'MyClass'; 'MyClass'; package package MyClass; MyClass; new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; _init _init ($self,%param) $self->id( $param{id} $self->id( $param{id} ); ); new new ($class,%param) $self = new MyClass(%param); $self = new MyClass(%param); $self->_init(%param); $self->_init(%param); MyClass; MyClass; return $self; return $self; MySubclass; MySubclass; $v $v == new new MyClass( ); MyClass( ); _init _init $n $n == new new MySubclass( ); MySubclass( ); ($self,%param) $self->name( $self->name( $param{name} $param{name} ); ); 35

34 Inheritance package package MySubclass; MySubclass; parent parent 'MyClass'; 'MyClass'; package package MyClass; MyClass; new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; _init _init ($self,%param) $self->id( $param{id} $self->id( $param{id} ); ); new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; MyClass; MyClass; MySubclass; MySubclass; $v $v == new new MyClass( ); MyClass( ); $n $n == new new MySubclass( ); MySubclass( ); _init _init ($self,%param) $self->super::_init(%param); $self->super::_init(%param); $self->name( $self->name( $param{name} $param{name} ); ); 36

35 Abstraction package package MySubclass; MySubclass; parent parent 'MyClass'; 'MyClass'; package package MyClass; MyClass; ## abstract abstract new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; _init _init ($self,%param) $self->id( $param{id} $self->id( $param{id} ); ); new new ($class,%param) $self = {}; $self = {}; $self->_init(%param); $self->_init(%param); return return $self; $self; MyClass; MyClass; MySubclass; MySubclass; $v $v == new new MyClass(); MyClass(); $n $n == new new MySubclass(); MySubclass(); _init _init ($self,%param) $self->super::_init(%param); $self->super::_init(%param); $self->name( $self->name( $param{name} $param{name} ); ); id id 37

36 Object-Orientation Recap2 (Constructors, Attributes, Methods, Initialisation) Recap1 Composition: Objects within objects Inheritance: parent, SUPER:: no class constructor Abstraction no superclass constructor 38

37 Perl OO Frameworks: Moose 39

38 3) Example Application: Graph Theory Basic overview of graph theory Implementing graphs with: Native Perl (hashes) Object-Orientation CPAN: The Graph module 40

39 Basic Overview of Graph Theory A graph is: a collection of nodes (vertices)... connected by edges A graph can be: undirected / directed unweighted / weighted Graph Theory is the study of these structures and their properties. 41

40 A Graph as a Hash of Edges graph.pl data.txt aa bb aa bb bb dd aa bb %edge=(); %edge=(); open open INFILE,"<data.txt"; INFILE,"<data.txt"; while while (<INFILE>) (<INFILE>) ## $_ $_ implicit implicit chomp; chomp; ($from,$to) ($from,$to) == split split "\t"; "\t"; $edge{$from}{$to} $edge{$from}{$to} == 1; 1; close close INFILE; INFILE; foreach foreach $from $from (( foreach foreach $to $to (( printf printf "%s\n", "%s\n", $$ aa bb graph.pl graph.pl bb aa dd sort sort keys keys %edge %edge )) sort sort keys keys %{$edge{$from %{$edge{$from )) join("\t",$from,$to); join("\t",$from,$to); 42

41 Weighted Edges (Count) data.txt aa bb aa bb bb dd aa bb graph.pl ## build build aa hash hash of of graph graph ## $edge{$from}{$to} $edge{$from}{$to} == $edge{$from}{$to}++; $edge{$from}{$to}++; edges edges 1; 1; $$ aa bb graph.pl graph.pl bb aa 11 dd 11 ## plain plain text text output output of of graph graph edges edges $weight $weight == $edge{$from}{$to}; $edge{$from}{$to}; printf printf "%s\n", "%s\n", join("\t",$from,to,$weight); join("\t",$from,to,$weight);

42 Weighted Edges (Sum) data.txt aa bb aa bb bb dd aa bb graph.pl $$ aa bb graph.pl graph.pl bb aa 11 dd 33 ## build build aa hash hash ## ($from,$to) ($from,$to) == split split "\t"; "\t"; ($from,$to,$weight) ($from,$to,$weight) == split split "\t"; "\t"; ## $edge{$from}{$to}++; $edge{$from}{$to}++; $edge{$from}{$to}+=$weight; $edge{$from}{$to}+=$weight; ## plain plain text text output output $weight $weight == $edge{$from}{$to}; $edge{$from}{$to}; printf printf "%s\n", "%s\n", join("\t",$from,to,$weight); join("\t",$from,to,$weight);

43 Weighted Edges (Array) data.txt aa bb aa bb bb dd aa bb $$ graph.pl graph.pl 55 aa bb 5:4 5:4 77 graph.pl bb 7:2 7:2 33 aa # build a hash # build a hash dd # $edge{$from}{$to}+=$weight; # $edge{$from}{$to}+=$weight; $weight; $weight; ## plain plain text text output output $weight $weight == join( :,@{$edge{$from}{$to); join( :,@{$edge{$from}{$to); printf printf "%s\n", "%s\n", join("\t",$from,to,$weight); join("\t",$from,to,$weight); ); ); ); ); 45

44 Node Attributes data.txt aa bb aa bb bb dd aa bb We count the edges a node participates in... graph.pl $$ aa bb dd graph.pl graph.pl %edge=(); %edge=(); %node=(); %node=(); open open INFILE,"<data.txt"; INFILE,"<data.txt"; while while (<INFILE>) (<INFILE>) chomp; chomp; ($from,$to) ($from,$to) == split split "\t"; "\t"; $edge{$from}{$to}++; $edge{$from}{$to}++; $node{$from}++; but don t distinguish $node{$from}++; $node{$to}++; from and to! $node{$to}++; close close INFILE; INFILE; 46

45 Node Attributes graph.pl so we add node attributes... %edge=(); %edge=(); %node=(); %node=(); open open INFILE,"<data.txt"; INFILE,"<data.txt"; while while (<INFILE>) (<INFILE>) chomp; chomp; ($from,$to) ($from,$to) == split split "\t"; "\t"; $edge{$from}{$to}++; $edge{$from}{$to}++; $node{$from}{ from }++; looks Object $node{$from}{ from }++; $node{$to}{ to }++; Oriented!!! $node{$to}{ to }++; close close INFILE; INFILE; Class Instance Attribute Value 47

46 Bespoke Classes MyGraph/Edge.pm package package MyGraph::Edge; MyGraph::Edge; MyGraph/Graph.pm 1; 1; new new getsource getsource getdest getdest getweight getweight package package MyGraph::Graph; MyGraph::Graph; MyGraph::Edge; MyGraph::Edge; MyGraph::Node; MyGraph::Node; 1; 1; new new MyGraph/Node.pm addedge addedge getedges { } package package MyGraph::Node; MyGraph::Node; getedges { } 1; 1; new new addnode addnode getnodes getnodes getproperty getproperty graph.pl MyGraph::Graph; MyGraph::Graph; MyGraph::Edge; MyGraph::Edge; $g $g == new new Graph(); Graph(); while while (<INFILE>) (<INFILE>) $g->addedge($f,$t,$w); $g->addedge($f,$t,$w); foreach foreach $e $e ($g->getedges()) ($g->getedges()) $w $w == $e->getweight(); $e->getweight(); 48

47 Perl Graph Module $$ cpan cpan Graph Graph Graph Graph is is up up to to date date (0.9704). (0.9704). $$ 49

48 Perl Graph Module over over routines, routines, including: including: add_edge add_edge add_edges add_edges add_vertex add_vertex add_vertices add_vertices add_path add_path add_weighted_edge add_weighted_edge add_weighted_edges add_weighted_edges add_weighted_vertex add_weighted_vertex add_weighted_vertices add_weighted_vertices add_weighted_path add_weighted_path has_edge has_edge has_vertex has_vertex has_path has_path has_edges has_edges has_vertices has_vertices has_cycle has_cycle is_cyclic is_cyclic is_directed is_directed is_connected is_connected is_biconnected is_biconnected is_edge_connected is_edge_connected is_transitive is_transitive is_acyclic is_acyclic is_undirected is_undirected is_strongly_connected is_strongly_connected is_weakly_connected is_weakly_connected is_edge_separable is_edge_separable transitive_closure transitive_closure transpose_graph transpose_graph minimum_spanning_tree minimum_spanning_tree 50

49 Perl & Graph Theory - Recap Graphs in native Perl using nested hashes: Object-Oriented implementation: $class{instance}{attribute}=value (simple or complex) encapsulate functionality into packages/classes CPAN Graph module: provides extensive graph theory functionality follows Object-Oriented model typical of many CPAN modules 51

50 Conclusions While Perl is not strictly an OO platform... applying OO principles exposes aspects of the paradigm metaphor between nested hashes and OO classes OO thinking shapes many CPAN modules understanding is helpful for using and contributing modules Perl philsophy: favours convention over enforcement context: local readability vs global consistency programmer freedom / responsibility 52

51 Thank You! Nick Questions and Discussion? 53

52 Hello world & the Perl philosophy Perl was designed to work smoothly in the same way that natural language works smoothly. (p. 2) open LOG, >$logfile or die Failed to open $logfile ; die Failed to open $logfile unless open LOG, >$logfile ; print LOG Logging...\n if $logging_enabled; $logging_enabled and print LOG Logging...\n ; if ($logging_enabled) { print LOG Logging...\n ; } The Camel Book Larry Wall et al., Programming Perl (1996) 54

PERL Scripting - Course Contents

PERL Scripting - Course Contents PERL Scripting - Course Contents Day - 1 Introduction to PERL Comments Reading from Standard Input Writing to Standard Output Scalar Variables Numbers and Strings Use of Single Quotes and Double Quotes

More information

CSCI 4152/6509 Natural Language Processing. Perl Tutorial CSCI 4152/6509. CSCI 4152/6509, Perl Tutorial 1

CSCI 4152/6509 Natural Language Processing. Perl Tutorial CSCI 4152/6509. CSCI 4152/6509, Perl Tutorial 1 CSCI 4152/6509 Natural Language Processing Perl Tutorial CSCI 4152/6509 Vlado Kešelj CSCI 4152/6509, Perl Tutorial 1 created in 1987 by Larry Wall About Perl interpreted language, with just-in-time semi-compilation

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 9/11/2013 Textual data processing (Perl) 1 Announcements If you did not get a PIN to enroll, contact Stephanie Meik 2 Outline Perl Basics (continued) Regular Expressions

More information

1. Introduction. 2. Scalar Data

1. Introduction. 2. Scalar Data 1. Introduction What Does Perl Stand For? Why Did Larry Create Perl? Why Didn t Larry Just Use Some Other Language? Is Perl Easy or Hard? How Did Perl Get to Be So Popular? What s Happening with Perl Now?

More information

Object-Oriented-Programming! (OOP)

Object-Oriented-Programming! (OOP) Object-Oriented-Programming! (OOP) Basically it s all about abstraction & information hiding n Good programs consist of layer upon layer of reusable code (think of software tools). n The programmer should

More information

IT441. Subroutines. (a.k.a., Functions, Methods, etc.) DRAFT. Network Services Administration

IT441. Subroutines. (a.k.a., Functions, Methods, etc.) DRAFT. Network Services Administration IT441 Network Services Administration Subroutines DRAFT (a.k.a., Functions, Methods, etc.) Organizing Code We have recently discussed the topic of organizing data (i.e., arrays and hashes) in order to

More information

CS 105 Perl: Perl subroutines and Disciplined Perl

CS 105 Perl: Perl subroutines and Disciplined Perl CS 105 Perl: Perl subroutines and Disciplined Perl Nathan Clement! February 3, 2014 Agenda We will cover Perl scoping, subroutines (user- defined functions) and then we continue on to Perl s features for

More information

Pathologically Eclectic Rubbish Lister

Pathologically Eclectic Rubbish Lister Pathologically Eclectic Rubbish Lister 1 Perl Design Philosophy Author: Reuben Francis Cornel perl is an acronym for Practical Extraction and Report Language. But I guess the title is a rough translation

More information

Perl Scripting. Students Will Learn. Course Description. Duration: 4 Days. Price: $2295

Perl Scripting. Students Will Learn. Course Description. Duration: 4 Days. Price: $2295 Perl Scripting Duration: 4 Days Price: $2295 Discounts: We offer multiple discount options. Click here for more info. Delivery Options: Attend face-to-face in the classroom, remote-live or on-demand streaming.

More information

More Perl. CS174 Chris Pollett Oct 25, 2006.

More Perl. CS174 Chris Pollett Oct 25, 2006. More Perl CS174 Chris Pollett Oct 25, 2006. Outline Loops Arrays Hashes Functions Selection Redux Last day we learned about how if-else works in Perl. Perl does not have a switch statement Like Javascript,

More information

COMS 3101 Programming Languages: Perl. Lecture 5

COMS 3101 Programming Languages: Perl. Lecture 5 COMS 3101 Programming Languages: Perl Lecture 5 Fall 2013 Instructor: Ilia Vovsha http://www.cs.columbia.edu/~vovsha/coms3101/perl Lecture Outline Packages & Modules Concepts: Subroutine references Symbolic

More information

COMS 3101 Programming Languages: Perl. Lecture 2

COMS 3101 Programming Languages: Perl. Lecture 2 COMS 3101 Programming Languages: Perl Lecture 2 Fall 2013 Instructor: Ilia Vovsha http://www.cs.columbia.edu/~vovsha/coms3101/perl Lecture Outline Control Flow (continued) Input / Output Subroutines Concepts:

More information

The Eobj Perl environment

The Eobj Perl environment The Eobj Perl environment Eli Billauer elib@flextronics.co.il http://search.cpan.org/author/billauer/ The Eobj Perl environment p.1 Lecture overview Introduction: Me, Eobj and OO programming Eobj classes

More information

IT441. Network Services Administration. Data Structures: Arrays

IT441. Network Services Administration. Data Structures: Arrays IT441 Network Services Administration Data Structures: Arrays Data Types Remember there are three basic data types in Perl o Numeric o String o Boolean (Logical) I differentiate between data types and

More information

Introduction to Perl Session 6. special variables subroutines Introduction to Perl

Introduction to Perl Session 6. special variables subroutines Introduction to Perl 1.0.1.8.6 Introduction to Perl Session 6 special variables subroutines 6/17/2008 1.0.1.8.6 - Introduction to Perl - Special Variables and Subroutines 1 I/O Recap file handles are created using open(f,$file);

More information

COMS 3101 Programming Languages: Perl. Lecture 6

COMS 3101 Programming Languages: Perl. Lecture 6 COMS 3101 Programming Languages: Perl Lecture 6 Fall 2013 Instructor: Ilia Vovsha http://www.cs.columbia.edu/~vovsha/coms3101/perl Lecture Outline Concepts: Subroutine references Symbolic references Saving

More information

PERL 6 and PARROT An Overview. Presentation for NYSA The New York System Administrators Association

PERL 6 and PARROT An Overview. Presentation for NYSA The New York System Administrators Association PERL 6 and PARROT An Overview Presentation for NYSA The New York System Administrators Association June 9 th, 2004 By Josh Rabinowitz http://skateboarddirectory.com Why Perl 6? Perl 5 codebase difficult

More information

package YourModule; require = = qw(munge frobnicate); # symbols to export on request

package YourModule; require = = qw(munge frobnicate); # symbols to export on request NAME SYNOPSIS Exporter - Implements default import method for modules In module YourModule.pm: require Exporter; @EXPORT_OK = qw(munge frobnicate); # symbols to export on request or use Exporter 'import';

More information

Perl (5 Days Content)

Perl (5 Days Content) Perl (5 Days Content) Pre-requisites: Knowledge of any programming language ( C / C++ / Shell Scripting) Objective of the Course: The participants should be in a position to understand Perl Scripts written

More information

Inheritance. Transitivity

Inheritance. Transitivity Inheritance Classes can be organized in a hierarchical structure based on the concept of inheritance Inheritance The property that instances of a sub-class can access both data and behavior associated

More information

Perl. Many of these conflict with design principles of languages for teaching.

Perl. Many of these conflict with design principles of languages for teaching. Perl Perl = Practical Extraction and Report Language Developed by Larry Wall (late 80 s) as a replacement for awk. Has grown to become a replacement for awk, sed, grep, other filters, shell scripts, C

More information

Scripting Languages Perl Basics. Course: Hebrew University

Scripting Languages Perl Basics. Course: Hebrew University Scripting Languages Perl Basics Course: 67557 Hebrew University אליוט יפה Jaffe Lecturer: Elliot FMTEYEWTK Far More Than Everything You've Ever Wanted to Know Perl Pathologically Eclectic Rubbish Lister

More information

5th State of the Onion. Larry Wall

5th State of the Onion. Larry Wall 5th State of the Onion Larry Wall Talk 1 An Overview of Perl Perl 5 Perl 6 Talk 2 Bits and Pieces 33 lightning talks in half an hour See Apocalypse 2 Expected apocalyptic error rate: 5% Talk 3 Unary and

More information

Perl. Perl. Perl. Which Perl

Perl. Perl. Perl. Which Perl Perl Perl Perl = Practical Extraction and Report Language Developed by Larry Wall (late 80 s) as a replacement for awk. Has grown to become a replacement for awk, sed, grep, other filters, shell scripts,

More information

COMP284 Scripting Languages Lecture 3: Perl (Part 2) Handouts

COMP284 Scripting Languages Lecture 3: Perl (Part 2) Handouts COMP284 Scripting Languages Lecture 3: Perl (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

More information

Beginning Perl. Third Edition. Apress. JAMES LEE with SIMON COZENS

Beginning Perl. Third Edition. Apress. JAMES LEE with SIMON COZENS Beginning Perl Third Edition JAMES LEE with SIMON COZENS Apress About the Author... About the Technical Reviewers Acknowledgements Suitrod yetion «. xvi xvii xviii «xix. Chapter 1: First Steps in Perl..

More information

Lecture 2: Programming in Perl: Introduction 1

Lecture 2: Programming in Perl: Introduction 1 Lecture 2: Programming in Perl: Introduction 1 Torgeir R. Hvidsten Professor Norwegian University of Life Sciences Guest lecturer Umeå Plant Science Centre Computational Life Science Cluster (CLiC) 1 This

More information

Subroutines. Subroutines. The Basics. aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc.

Subroutines. Subroutines. The Basics. aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc. Subroutines Subroutines aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc We ll just say Subroutines. "Functions" generally means built-in functions perldoc perlsub The Basics

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

CMSC 331 Final Exam Fall 2013

CMSC 331 Final Exam Fall 2013 CMSC 331 Final Exam Fall 2013 Name: UMBC username: You have two hours to complete this closed book exam. Use the backs of these pages if you need more room for your answers. Describe any assumptions you

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 6/7/2012 Textual data processing (Perl) CS 5142 Cornell University 9/7/13 1 Administrative Announcements Homework 2 due Friday at 6pm. First prelim 9/27, Review on

More information

Outline. CS3157: Advanced Programming. Feedback from last class. Last plug

Outline. CS3157: Advanced Programming. Feedback from last class. Last plug Outline CS3157: Advanced Programming Lecture #2 Jan 23 Shlomo Hershkop shlomo@cs.columbia.edu Feedback Introduction to Perl review and continued Intro to Regular expressions Reading Programming Perl pg

More information

@EXPORT_OK = qw(munge frobnicate); # symbols to export on request

@EXPORT_OK = qw(munge frobnicate); # symbols to export on request NAME Exporter - Implements default import method for modules SYNOPSIS In module YourModule.pm: package YourModule; require Exporter; @ISA = qw(exporter); @EXPORT_OK = qw(munge frobnicate); # symbols to

More information

Perl and Python ESA 2007/2008. Eelco Schatborn 27 September 2007

Perl and Python ESA 2007/2008. Eelco Schatborn 27 September 2007 Perl and Python ESA 2007/2008 Eelco Schatborn eelco@os3.nl 27 September 2007 ESA: Perl Vandaag: 1. Perl introduction 2. Basic Perl: types, variables, statements,... 3. Object Oriented Perl 4. Documentation

More information

They grow as needed, and may be made to shrink. Officially, a Perl array is a variable whose value is a list.

They grow as needed, and may be made to shrink. Officially, a Perl array is a variable whose value is a list. Arrays Perl arrays store lists of scalar values, which may be of different types. They grow as needed, and may be made to shrink. Officially, a Perl array is a variable whose value is a list. A list literal

More information

Control Structures. Important Semantic Difference

Control Structures. Important Semantic Difference 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 only has one statement, you must include the braces.

More information

Object Oriented Programming and Perl

Object Oriented Programming and Perl Object Oriented Programming and Perl Prog for Biol 2011 Simon Prochnik 1 Why do we teach you about objects and object-oriented programming (OOP)? Objects and OOP allow you to use other people s code to

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 9/20/2013 Context and Modules (Perl) Scripting as Glue 1 Outline Programming in the large Scripting as glue 2 Modules Module = file p/q.pm that starts with declaration

More information

Perl. Interview Questions and Answers

Perl. Interview Questions and Answers and Answers Prepared by Abhisek Vyas Document Version 1.0 Team, www.sybaseblog.com 1 of 13 Q. How do you separate executable statements in perl? semi-colons separate executable statements Example: my(

More information

Hands-On Perl Scripting and CGI Programming

Hands-On Perl Scripting and CGI Programming Hands-On Course Description This hands on Perl programming course provides a thorough introduction to the Perl programming language, teaching attendees how to develop and maintain portable scripts useful

More information

Tieing and Overloading Objects in Perl. Dave Cross Magnum Solutions

Tieing and Overloading Objects in Perl. Dave Cross Magnum Solutions Tieing and Overloading Objects in Perl Dave Cross Magnum Solutions What We Will Cover Why tie or overload? What We Will Cover Why tie or overload? Tieing objects What We Will Cover Why tie or overload?

More information

Modularity and Reusability I. Functions and code reuse

Modularity and Reusability I. Functions and code reuse Modularity and Reusability I Functions and code reuse Copyright 2006 2009 Stewart Weiss On being efficient When you realize that a piece of Perl code that you wrote may be useful in future programs, you

More information

Inheritance, Polymorphism and the Object Memory Model

Inheritance, Polymorphism and the Object Memory Model Inheritance, Polymorphism and the Object Memory Model 1 how objects are stored in memory at runtime? compiler - operations such as access to a member of an object are compiled runtime - implementation

More information

1B1b Classes in Java Part I

1B1b Classes in Java Part I 1B1b Classes in Java Part I Agenda Defining simple classes. Instance variables and methods. Objects. Object references. 1 2 Reading You should be reading: Part I chapters 6,9,10 And browsing: Part IV chapter

More information

CSCI 4152/6509 Natural Language Processing Lecture 6: Regular Expressions; Text Processing in Perl

CSCI 4152/6509 Natural Language Processing Lecture 6: Regular Expressions; Text Processing in Perl Lecture 6 p.1 Faculty of Computer Science, Dalhousie University CSCI 4152/6509 Natural Language Processing Lecture 6: Regular Expressions; Text Processing in Perl 18-Jan-2019 Location: LSC Psychology P5260

More information

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism Block 1: Introduction to Java Unit 4: Inheritance, Composition and Polymorphism Aims of the unit: Study and use the Java mechanisms that support reuse, in particular, inheritance and composition; Analyze

More information

Web Application Development

Web Application Development Web Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie JavaScript JAVASCRIPT FUNDAMENTALS Agenda

More information

Perl Tutorial. Diana Inkpen. School of Information Technology and Engineering University of Ottawa. CSI 5180, Fall 2004

Perl Tutorial. Diana Inkpen. School of Information Technology and Engineering University of Ottawa. CSI 5180, Fall 2004 Perl Tutorial Diana Inkpen School of Information Technology and Engineering University of Ottawa CSI 5180, Fall 2004 1 What is Perl Practical Extraction and Report Language. Created, implemented, maintained

More information

Programming overview

Programming overview Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Welcome to Research Computing Services training week! November 14-17, 2011

Welcome to Research Computing Services training week! November 14-17, 2011 Welcome to Research Computing Services training week! November 14-17, 2011 Monday intro to Perl, Python and R Tuesday learn to use Titan Wednesday GPU, MPI and profiling Thursday about RCS and services

More information

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

Beginning Perl. Mark Senn. September 11, 2007

Beginning Perl. Mark Senn. September 11, 2007 GoBack Beginning Perl Mark Senn September 11, 2007 Overview Perl is a popular programming language used to write systen software, text processing tools, World Wide Web CGI programs, etc. It was written

More information

CS 105 Perl: Modules and Objects

CS 105 Perl: Modules and Objects CS 105 Perl: Modules and Objects February 20, 2013 Agenda Today s lecture is an introduction to Perl modules and objects, but first we will cover a handy feature Perl has for making data structures. Where

More information

Abstract Data Types. Functional Programming and Reasoning. Dr Hans Georg Schaathun. University of Surrey. Spring 2010 Week 4

Abstract Data Types. Functional Programming and Reasoning. Dr Hans Georg Schaathun. University of Surrey. Spring 2010 Week 4 Abstract Data Types Functional Programming and Reasoning Dr Hans Georg Schaathun University of Surrey Spring 2010 Week 4 Dr Hans Georg Schaathun Abstract Data Types Spring 2010 Week 4 1 / 32 Outline 1

More information

Separate compilation. Topic 6: Runtime Environments p.1/21. CS 526 Topic 6: Runtime Environments The linkage convention

Separate compilation. Topic 6: Runtime Environments p.1/21. CS 526 Topic 6: Runtime Environments The linkage convention Runtime Environment The Procedure Abstraction and Separate Compilation Topics we will cover The procedure abstraction and linkage conventions Runtime storage convention Non-local data access (brief) These

More information

Programming Perls* Objective: To introduce students to the perl language.

Programming Perls* Objective: To introduce students to the perl language. Programming Perls* Objective: To introduce students to the perl language. Perl is a language for getting your job done. Making Easy Things Easy & Hard Things Possible Perl is a language for easily manipulating

More information

Table of Contents Preface Bare Necessities... 17

Table of Contents Preface Bare Necessities... 17 Table of Contents Preface... 13 What this book is about?... 13 Who is this book for?... 14 What to read next?... 14 Personages... 14 Style conventions... 15 More information... 15 Bare Necessities... 17

More information

COMP 110/L Lecture 19. Kyle Dewey

COMP 110/L Lecture 19. Kyle Dewey COMP 110/L Lecture 19 Kyle Dewey Outline Inheritance extends super Method overriding Automatically-generated constructors Inheritance Recap -We talked about object-oriented programming being about objects

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

... and run the script as /path/to/script.pl. Of course, it'll need to be executable first, so chmod 755 script.pl (under Unix).

... and run the script as /path/to/script.pl. Of course, it'll need to be executable first, so chmod 755 script.pl (under Unix). NAME DESCRIPTION What is Perl? perlintro -- a brief introduction and overview of Perl This document is intended to give you a quick overview of the Perl programming language, along with pointers to further

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

CSE 12 Week Eight, Lecture One

CSE 12 Week Eight, Lecture One CSE 12 Week Eight, Lecture One Heap: (The data structure, not the memory area) - A binary tree with properties: - 1. Parent s are greater than s. o the heap order - 2. Nodes are inserted so that tree is

More information

What is PERL?

What is PERL? Perl For Beginners What is PERL? Practical Extraction Reporting Language General-purpose programming language Creation of Larry Wall 1987 Maintained by a community of developers Free/Open Source www.cpan.org

More information

The Beauty of Perl. 1 Introduction. 2 The Perl Interpreter

The Beauty of Perl. 1 Introduction. 2 The Perl Interpreter The Beauty of Perl Jordan Marshall Matthew Ghigliotti 1 Introduction Perl is an amazing programming language. Perl is amazing because it is both simple and expressive. You can open a file and search through

More information

package CLASS_NAME; use Class::Struct; # declare struct, based on array, implicit class name: struct( ELEMENT_NAME => ELEMENT_TYPE,...

package CLASS_NAME; use Class::Struct; # declare struct, based on array, implicit class name: struct( ELEMENT_NAME => ELEMENT_TYPE,... NAME SYNOPSIS Class::Struct - declare struct-like datatypes as Perl classes # declare struct, based on array: struct( CLASS_NAME => [ ELEMENT_NAME => ELEMENT_TYPE,... ]); # declare struct, based on hash:

More information

Learning Perl 6. brian d foy, Version 0.6, Nordic Perl Workshop 2007

Learning Perl 6. brian d foy, Version 0.6, Nordic Perl Workshop 2007 Learning Perl 6 brian d foy, Version 0.6, Nordic Perl Workshop 2007 for the purposes of this tutorial Perl 5 never existed Don t really do this $ ln -s /usr/local/bin/pugs /usr/bin/perl

More information

Building custom components IAT351

Building custom components IAT351 Building custom components IAT351 Week 1 Lecture 1 9.05.2012 Lyn Bartram lyn@sfu.ca Today Review assignment issues New submission method Object oriented design How to extend Java and how to scope Final

More information

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO

More information

CS 105 Perl: File I/O, slices, and array manipulation

CS 105 Perl: File I/O, slices, and array manipulation CS 105 Perl: File I/O, slices, and array manipulation Nathan Clement January 27, 2013! Agenda Intermediate iteration last and next Intermediate I/O Special variables Array manipulation push, pop, shift,

More information

CS 105 Perl: Completing the Toolbox

CS 105 Perl: Completing the Toolbox CS 105 Perl: Completing the Toolbox March 4, 2013 Agenda autodie with open Inspecting scalars perl -c Unary coercion Topicalization ~~ Unique list idiom Schwartzian Transform Using // for defaults and

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm History Simula 67 A Simulation Language 1967 (Algol 60 based) Smalltalk OO Language 1972 (1 st version) 1980 (standard) Background Ideas Record + code OBJECT (attributes + methods)

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Advanced Perl. Boston University Information Services & Technology. Course Coordinator: Timothy Kohl. Outline. more on functions

Advanced Perl. Boston University Information Services & Technology. Course Coordinator: Timothy Kohl. Outline. more on functions Advanced Perl Boston University Information Services & Technology Course Coordinator: Timothy Kohl Last Modified: 05/12/15 Outline more on functions references and anonymous variables local vs. global

More information

Learning Perl Objects, References, and Modules

Learning Perl Objects, References, and Modules Learning Perl Objects, References, and Modules Randal L. Schwartz with Tom Phoenix HLuHB Darmstadt Illlllllllllllllllllllll 15760214 O'REILLY* Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

More information

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

Object Oriented Programming with Perl

Object Oriented Programming with Perl Object Oriented Programming with Perl Yet Another Perl Conference Amsterdam, August 2 4, 2001 2001 Squirrel Consultancy. All rights reserved. Object Oriented Programming with Perl Preface 2001 Squirrel

More information

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Department of Computer Science Why C? Low-level Direct access to memory WYSIWYG (more or less) Effectively

More information

pairs unpairs pairkeys pairvalues pairfirst pairgrep pairmap

pairs unpairs pairkeys pairvalues pairfirst pairgrep pairmap NAME SYNOPSIS List::Util - A selection of general-utility list subroutines use List::Util qw( reduce any all none notall first max maxstr min minstr product sum sum0 pairs unpairs pairkeys pairvalues pairfirst

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

Programming Language Concepts: Lecture 2

Programming Language Concepts: Lecture 2 Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 2, 19 January 2009 Classes and

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

An Introduction to Perl Modules

An Introduction to Perl Modules An Introduction to Perl Modules Writing, Documenting and Testing Object-Oriented Perl Modules Author: Madison Kelly, mkelly@alteeve.com Date: October 29, 2009 Shameless Plug: http://alteeve.com http://alteeve.com

More information

perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sletters][,-xlevel] prog.pl

perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sletters][,-xlevel] prog.pl NAME SYNOPSIS DESCRIPTION OPTIONS B::Deparse - Perl compiler backend to produce perl code perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sletters][,-xlevel] prog.pl B::Deparse is a backend module for

More information

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects Lecture 4: Fundamentals of Object Technology Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Credit where Credit is Due Some material presented in this lecture

More information

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline :: Module Title Duration : Intro to JAVA SE7 and Programming using JAVA SE7 : 9 days Course Description The Java SE 7 Fundamentals course was designed to enable students with little or no programming experience

More information

We do not teach programming

We do not teach programming We do not teach programming We do not teach C Take a course Read a book The C Programming Language, Kernighan, Richie Georgios Georgiadis Negin F.Nejad This is a brief tutorial on C s traps and pitfalls

More information

CSE Lecture In Class Example Handout

CSE Lecture In Class Example Handout CSE 30321 Lecture 07-09 In Class Example Handout Part A: A Simple, MIPS-based Procedure: Swap Procedure Example: Let s write the MIPS code for the following statement (and function call): if (A[i] > A

More information

class objects instances Fields Constructors Methods static

class objects instances Fields Constructors Methods static Class Structure Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance variables)that hold the data for each object Constructors that

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

More information

G52CPP C++ Programming Lecture 7. Dr Jason Atkin

G52CPP C++ Programming Lecture 7. Dr Jason Atkin G52CPP C++ Programming Lecture 7 Dr Jason Atkin 1 This lecture classes (and C++ structs) Member functions inline functions 2 Last lecture: predict the sizes 3 #pragma pack(1) #include struct A

More information

Java: introduction to object-oriented features

Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

The Procedure Abstraction

The Procedure Abstraction The Procedure Abstraction Procedure Abstraction Begins Chapter 6 in EAC The compiler must deal with interface between compile time and run time Most of the tricky issues arise in implementing procedures

More information

Client-Side Web Technologies. JavaScript Part I

Client-Side Web Technologies. JavaScript Part I Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful

More information

UNIX Shell Programming

UNIX Shell Programming $!... 5:13 $$ and $!... 5:13.profile File... 7:4 /etc/bashrc... 10:13 /etc/profile... 10:12 /etc/profile File... 7:5 ~/.bash_login... 10:15 ~/.bash_logout... 10:18 ~/.bash_profile... 10:14 ~/.bashrc...

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 10 - Object-Oriented Programming Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages

More information

TYPES, VALUES AND DECLARATIONS

TYPES, VALUES AND DECLARATIONS COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier

More information