Mis on tõene? Tsüklid, failihaldus. if - näited. unless - näited. unless. Merle Sibola. if ($arv > $suur) { #leitakse suurim arv $suur=$arv; } #if

Size: px
Start display at page:

Download "Mis on tõene? Tsüklid, failihaldus. if - näited. unless - näited. unless. Merle Sibola. if ($arv > $suur) { #leitakse suurim arv $suur=$arv; } #if"

Transcription

1 Mis on tõene? Tsüklid, failihaldus Merle Sibola iga string on tõene, välja arvatud "" ja "0" iga number on tõene, v.a. number 0 Iga viide (reference) on tõene Iga defineerimata muutuja on väär. if if (EXPR) { if (EXPR) { else { if (EXPR) { elsif (EXPR) { if (EXPR) { elsif (EXPR) { else { Tingimus sulgudes if - näited if ($arv > $suur) { #leitakse suurim arv $suur=$arv; #if if ($sone eq valmis ) { print Lõpetame.\n ; else { print Jätkame.\n ; unless unless (EXPR) { unless (EXPR) { else { unless (EXPR) { elsif (EXPR) { unless (EXPR) { elsif (EXPR) { else { unless ($a==1) { if ($a!= 1) { if (!($a == 1)) { unless - näited unless (chdir.. ) { print "Ei saa muuta kataloogi. Põhjus: $!\n\n"; #unless unless ($sone eq koik ) { uc $sone; 1

2 while / until LABEL while (EXPR) { LABEL while (EXPR) { continue { Kuni EXPR on tõene täidetakse tegevused. LABEL until (EXPR) { LABEL until (EXPR) { continue { Kuni EXPR on väär täidetakse tegevused while/until - näited while ($nimed[$i]) { print $nimed, ; $i++; until ($nimed[$i] eq ) { print $nimed[$i], ; $i++; Muutuja väärtuspiirkond while (my $rida = <STDIN>) { $rida = lc $rida; $i++ if $i == 0; Perli omapära continue { print $rida; #$rida on veel saadaval kiss ( me ) until $I_die; Shutup() unless $you_want_me_to_leave; #$rida pole enam väärtustatud for /foreach for (algväärtus; jätkamise tingimus; kuidas muutub väärtus) { for ($a=0; $a<26; $a++) { for ($a=0; $a<26; $a+=5) { foreach { foreach $nimi ( Mart, Mati, Maret ) { print $nimi; for / foreach - näited for $count (10,9,8,7,6,5,4,3,2,1, PÕMM ) { print $count\n ; sleep(1); for { s/ham/turkey/; foreach $value (@array) {$sum+=$value foreach $key (sort keys %hash) { print $key => $hash{$key\n ; 2

3 Blokid while, until, for, foreach last LABEL; next LABEL; redo LABEL; RIDA: while ($line = <STDIN>) { chop ($line); last RIDA if ($rida eq lopp ); next RIDA if ($rida eq veel ); do - näited do{ $line = <STDIN>; until $line eq.\n ; do{{ next if $x == $y; until $x++ > $z; SWITCH for ($I = 0;$I { for ($j = 0;$j { WID: foreach $this (@ary1) { JET: foreach $that (@ary2) { SWITCH: { /^abc/ && do { $abc=1; last SWITCH; /^def/ && do { $nothing=1; või if (/^abc/ ) { elsif (/^def/) { else { $nothing=1; if ($ary1[$i] > $ary2[$j]) { last; $ary1[$i] += $ary2[$j]; next WID if $this > $that; $this += $that; Sisend ja väljund STDIN standard sisend (klaviatuur) $rida = <STDIN>; $rida = <FAIL>; STDOUT standard väljund (ekraan) print Tere ; print FAIL Tere ; Failist andmete lugemine open (FAIL, muu.txt ); $esimene_rida = = <FAIL>; while (<FAIL>) { print $_; close(fail); 3

4 Failist andmete lugemine (2) open (FAIL, andmed.txt ); while (<FAIL>) { chop; ($nimi,$synd,$lemmik) = split( ; ); if ($synd > 1990) { print Noored\n ; close (FAIL); Faili avamine open (FAIL,???miski.txt ); Lug K irj Lisa U us <PATH Y N N N >PATH N Y N Y >>PATH N Y Y Y +<PATH Y Y N N +>PATH Y Y N Y +>>PATH Y Y Y Y KÄSK N Y n/a n/a KÄSK Y N n/a n/a Lugemine ja kirjutamine unless (open LUG, <kust.txt ) { print Viga: $!\n ; unless (open KIRJ, >kuhu.txt ) { print Viga: $!\n ; while (<LUG>) { print KIRJ $_; close(lug); close(kirj); Printer /Meil open (PRINTER, lpr -Plp1 ) or die $!\n ; print PRINTER stuff\n ; close (PRINTER) or die $!\n ; unless (open (MAIL," /usr/lib/sendmail -t")) { print "Viga $!\n"; print MAIL "To: keegi\@ut.ee (Kellegi Nimi)\n"; print MAIL "From: minult\@ut.ee (Teine Nimi)\n"; print MAIL "Subject: Proov\n"; print MAIL See on juba meili sisu\n"; close(mail); Unixi käskude kasutamine open (SISU, ls -la. ); while (<SISU>) { print $_; close (SISU); Faili avamise viisid Perl 5.6 open (FH, < :raw, $path) or die $!\n ; :raw (binaarne) :text (tekst, vaikimisi) :latin1 (ISO ) :utf8 (UTF - 8) :xml Programmifaili algusesse: use open IN => :any, OUT => :utf8 ; 4

5 Lehekülje kujundamise näide #!/usr/local/bin/perl format top= #lk pea defineerimine Nimi Kuu Summa format STDOUT= @##.## $nimi, $kuu, $summa Lehekülje kujundamise näide (2) unless (open(file,'nimed.txt')) { #faili avamine print Faili avamine ebaõnnestus. Põhjus: $! ; #unless while(<file>){ #faili väljastamine chop; ($nimi,$kuu,$summa)=split(';'); write; #while Lehekülje kujundamise näide (3) Faili sisu: merle;mai;4.98 riina;sept;31.8 Tulemus: Nimi Kuu Summa merle mai 4.98 riina sept #!/usr/local/bin/perl $kata='/home/merle_h/tekst/'; Kataloogi läbimine #kataloog unless ( opendir DIR, $kata) { #kat. avamine print "Viga. Kataloogi ei saa avada: $!\n"; $arv=0; #abimuutuja, mis loeb kataloogide arvu Kataloogi läbimine (2) while ($filename = readdir DIR) { # nimi ilma teeta next if substr($filename,0,1) eq. ; # peidetud faile ei näita print "$filename\n"; if (-d $filename) { $arv++; closedir DIR; print $arv,"\n"; #kataloogi korral suurendame #arvu ühe võrra #kataloogi sulgemine 5

Puudub protseduur. Protseduuri nimi võib olla valesti kirjutatud. Protseduuri (või funktsiooni) poole pöördumisel on vähem argumente kui vaja.

Puudub protseduur. Protseduuri nimi võib olla valesti kirjutatud. Protseduuri (või funktsiooni) poole pöördumisel on vähem argumente kui vaja. Puudub protseduur. Protseduuri nimi võib olla valesti kirjutatud. Sub prog1() Msgox "Tere" Sub prog2() a = si(1) Protseduuri (või funktsiooni) poole pöördumisel on vähem argumente kui vaja. a = Sin() Protseduuri

More information

Bioinformatics. Computational Methods II: Sequence Analysis with Perl. George Bell WIBR Biocomputing Group

Bioinformatics. Computational Methods II: Sequence Analysis with Perl. George Bell WIBR Biocomputing Group Bioinformatics Computational Methods II: Sequence Analysis with Perl George Bell WIBR Biocomputing Group Sequence Analysis with Perl Introduction Input/output Variables Functions Control structures Arrays

More information

Unix, Perl and BioPerl

Unix, Perl and BioPerl Unix, Perl and BioPerl II: Sequence Analysis with Perl George Bell, Ph.D. WIBR Bioinformatics and Research Computing Sequence Analysis with Perl Introduction Input/output Variables Functions Control structures

More information

Sequence Analysis with Perl. Unix, Perl and BioPerl. Why Perl? Objectives. A first Perl program. Perl Input/Output. II: Sequence Analysis with Perl

Sequence Analysis with Perl. Unix, Perl and BioPerl. Why Perl? Objectives. A first Perl program. Perl Input/Output. II: Sequence Analysis with Perl Sequence Analysis with Perl Unix, Perl and BioPerl II: Sequence Analysis with Perl George Bell, Ph.D. WIBR Bioinformatics and Research Computing Introduction Input/output Variables Functions Control structures

More information

Tabelid <TABLE> Koostanud: Merike Hein

Tabelid <TABLE> Koostanud: Merike Hein Tabelid Tabelite kasutusvõimalus on HTML'is olemas juba pikka aega. Tabelimärgendite esmaseks kasutusalaks oli muidugi mõista tabelkujul info kuvamine. tähendab siis tabelite joonistamist.

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

MSDE Upgrade platvormile SQL 2005 Server Express SP4

MSDE Upgrade platvormile SQL 2005 Server Express SP4 MSDE Upgrade platvormile SQL 2005 Server Express SP4 NB! Windos XP puhul peab veenduma, et masinas oleks paigaldatud.net Framework vähemalt versioon 2.0!!! NB! Muutke oma SA parool turvaliseks ( minimaalne

More information

Perl for Biologists. Session 6 April 16, Files, directories and I/O operations. Jaroslaw Pillardy

Perl for Biologists. Session 6 April 16, Files, directories and I/O operations. Jaroslaw Pillardy Perl for Biologists Session 6 April 16, 2014 Files, directories and I/O operations Jaroslaw Pillardy Perl for Biologists 1.1 1 Reminder: What is a Hash? Array Hash Index Value Key Value 0 apple red fruit

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 Power of Perl. Perl. Perl. Change all gopher to World Wide Web in a single command

The Power of Perl. Perl. Perl. Change all gopher to World Wide Web in a single command The Power of Perl Perl Change all gopher to World Wide Web in a single command perl -e s/gopher/world Wide Web/gi -p -i.bak *.html Perl can be used as a command Or like an interpreter UVic SEng 265 Daniel

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

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc. Appendix B WORKSHOP SYS-ED/ Computer Education Techniques, Inc. 1 Scalar Variables 1. Write a Perl program that reads in a number, multiplies it by 2, and prints the result. 2. Write a Perl program that

More information

NAME DESCRIPTION. Declarations. Perl version documentation - perlsyn. perlsyn - Perl syntax

NAME DESCRIPTION. Declarations. Perl version documentation - perlsyn. perlsyn - Perl syntax NAME DESCRIPTION Declarations perlsyn - Perl syntax A Perl program consists of a sequence of declarations and statements which run from the top to the bottom. Loops, subroutines and other control structures

More information

Regulaaravaldised Unixis ja Windowsis

Regulaaravaldised Unixis ja Windowsis Tartu Ülikool Matemaatika-informaatikateaduskond Arvutiteaduse instituut Regulaaravaldised Unixis ja Windowsis Referaat Koostajad: Tarvo Kärberg, Marko Peterson, Kaupo Voormansik Juhendaja: Kersti Taurus

More information

Perl for Biologists. Regular Expressions. Session 7. Jon Zhang. April 23, Session 7: Regular Expressions CBSU Perl for Biologists 1.

Perl for Biologists. Regular Expressions. Session 7. Jon Zhang. April 23, Session 7: Regular Expressions CBSU Perl for Biologists 1. Perl for Biologists Session 7 April 23, 2014 Regular Expressions Jon Zhang Session 7: Regular Expressions CBSU Perl for Biologists 1.1 1 Review of Session 6 Each program has three default input/output

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

Script Programming Systems Skills in C and Unix

Script Programming Systems Skills in C and Unix Script Programming with Perl II 15-123 Systems Skills in C and Unix Subroutines sub sum { return $a + $b; } So we can call this as: $a = 12; $b = 10; $sum = sum(); print the sum is $sum\n ; Passing Arguments

More information

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

Andmebaasid (6EAP) I praktikum

Andmebaasid (6EAP) I praktikum Andmebaasid (6EAP) I praktikum Mõisteid Server on arvutisüsteem või selles töötav tarkvara, mis pakub teatud infoteenust sellega ühenduvatele klientidele. Klient on tarkvara, mis võimaldab suhelda serveriga.

More information

Systems Skills in C and Unix

Systems Skills in C and Unix 15-123 Systems Skills in C and Unix Plan Perl programming basics Operators loops, arrays, conditionals file processing subroutines, references Systems programming Command line arguments Perl intro Unix

More information

CS 230 Programming Languages

CS 230 Programming Languages CS 230 Programming Languages 09 / 16 / 2013 Instructor: Michael Eckmann Today s Topics Questions/comments? Continue Syntax & Semantics Mini-pascal Attribute Grammars More Perl A more complex grammar Let's

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

Vea haldus ja logiraamat hajutatud süsteemides Enn Õunapuu.

Vea haldus ja logiraamat hajutatud süsteemides Enn Õunapuu. Vea haldus ja logiraamat hajutatud süsteemides Enn Õunapuu enn.ounapuu@ttu.ee Millest tuleb jutt? Kuidas ma näen, millises sammus erinevad protsessid parasjagu on? Kuidas ma aru saan, kas protsess töötab

More information

SQL Server 2005 Expressi paigaldamine

SQL Server 2005 Expressi paigaldamine SQL Server 2005 Expressi paigaldamine Laadige alla.net Framework 2.0 http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d- 8edd-aab15c5e04f5 Avage http://www.microsoft.com/express/2005/sql/download/default.aspx

More information

Introduction to Perl. Perl Background. Sept 24, 2007 Class Meeting 6

Introduction to Perl. Perl Background. Sept 24, 2007 Class Meeting 6 Introduction to Perl Sept 24, 2007 Class Meeting 6 * Notes on Perl by Lenwood Heath, Virginia Tech 2004 Perl Background Practical Extraction and Report Language (Perl) Created by Larry Wall, mid-1980's

More information

Perl for Biologists. Session 9 April 29, Subroutines and functions. Jaroslaw Pillardy

Perl for Biologists. Session 9 April 29, Subroutines and functions. Jaroslaw Pillardy Perl for Biologists Session 9 April 29, 2015 Subroutines and functions Jaroslaw Pillardy Perl for Biologists 1.2 1 Suggestions Welcomed! There are three more sessions devoted to practical examples They

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

NAME DESCRIPTION. Declarations. Perl version documentation - perlsyn. perlsyn - Perl syntax

NAME DESCRIPTION. Declarations. Perl version documentation - perlsyn. perlsyn - Perl syntax NAME DESCRIPTION Declarations perlsyn - Perl syntax A Perl program consists of a sequence of declarations and statements which run from the top to the bottom. Loops, subroutines, and other control structures

More information

T-( )-MALV, Natural Language Processing The programming language Perl

T-( )-MALV, Natural Language Processing The programming language Perl T-(538 725)-MALV, Natural Language Processing The programming language Perl Hrafn Loftsson 1 Hannes Högni Vilhjálmsson 1 1 School of Computer Science, Reykjavik University September 2010 Outline 1 Perl

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

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

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

ADDENDUM V: PERL SCRIPTS

ADDENDUM V: PERL SCRIPTS ADDENDUM V: PERL SCRIPTS Angle_strain.pl #! /usr/local/bin/perl # Last update: nov/98, Renata Kover # angle_strain.pl # evaluates angle_strain_average in the molecule # taking into account the hybridization

More information

print STDERR "This is a debugging message.\n";

print STDERR This is a debugging message.\n; NAME DESCRIPTION perlopentut - simple recipes for opening files and pipes in Perl Whenever you do I/O on a file in Perl, you do so through what in Perl is called a filehandle. A filehandle is an internal

More information

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi Titolo presentazione Piattaforme Software per la Rete sottotitolo BASH Scripting Milano, XX mese 20XX A.A. 2016/17, Alessandro Barenghi Outline 1) Introduction to BASH 2) Helper commands 3) Control Flow

More information

Indian Institute of Technology Kharagpur. PERL Part II. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

Indian Institute of Technology Kharagpur. PERL Part II. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Indian Institute of Technology Kharagpur PERL Part II Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Kharagpur, INDIA Lecture 22: PERL Part II On completion, the student will be able

More information

A control expression must evaluate to a value that can be interpreted as true or false.

A control expression must evaluate to a value that can be interpreted as true or false. Control Statements Control Expressions A control expression must evaluate to a value that can be interpreted as true or false. How a control statement behaves depends on the value of its control expression.

More information

Süsteemprogrammeerimine keeles C

Süsteemprogrammeerimine keeles C Süsteemprogrammeerimine keeles C C Loeng 2 milles jätkame sisendi ja väljundiga tutvumist, räägime andmetüüpide teisendamisest, tähemärgi andmetüübist, massiividest ja pointeritest ja stringidest ja sellest,

More information

A Crash Course in Perl5

A Crash Course in Perl5 z e e g e e s o f t w a r e A Crash Course in Perl5 Part 5: Data Zeegee Software Inc. http://www.zeegee.com/ Terms and Conditions These slides are Copyright 2008 by Zeegee Software Inc. They have been

More information

COBOL Common Business-Oriented Language

COBOL Common Business-Oriented Language COBOL Common Business-Oriented Language Ain Uljas Ajalugu Esmaettekanne 28 mai 1959 Pentagonis peale seda kui American Departement of Defense palus grupil spetsialistidel luua ärivajadusi rahuldav keel,

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

Indian Institute of Technology Kharagpur. PERL Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

Indian Institute of Technology Kharagpur. PERL Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Indian Institute of Technology Kharagpur PERL Part III Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Kharagpur, INDIA Lecture 23: PERL Part III On completion, the student will be able

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

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

9.1 Origins and Uses of Perl

9.1 Origins and Uses of Perl 9.1 Origins and Uses of Perl - Began in the late 1980s as a more powerful replacement for the capabilities of awk (text file processing) and sh (UNIX system administration) - Now includes sockets for communications

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

EESTI STANDARD EVS-ISO 11620:2010

EESTI STANDARD EVS-ISO 11620:2010 EESTI STANDARD EVS-ISO INFORMATSIOON JA DOKUMENTATSIOON Raamatukogu tulemusindikaatorid Information and documentation Library performance indicators (ISO 11620:2008) EVS-ISO EESTI STANDARDI EESSÕNA NATIONAL

More information

(Refer Slide Time: 01:12)

(Refer Slide Time: 01:12) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #22 PERL Part II We continue with our discussion on the Perl

More information

Introduction to Ruby. SWEN-250 Personal Software Engineering

Introduction to Ruby. SWEN-250 Personal Software Engineering Introduction to Ruby SWEN-250 Personal Software Engineering A Bit of History Yukihiro "Matz'' Matsumoto Created a language he liked to work in. Been around since mid-90s. Caught on in early to mid 00s.

More information

EstEID Turvakiibi rakenduse kasutusjuhend

EstEID Turvakiibi rakenduse kasutusjuhend EstEID Turvakiibi rakenduse kasutusjuhend Dokumendi versioon: 01.11.2003 1 Sisukord Sisukord... 2 1 Kellele on dokument suunatud... 3 2 Kasutatud lühendid... 3 3 Kaardi äratundmine... 3 4 T=0 või T=1?...

More information

bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017

bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 Command Lists A command is a sequence of commands separated by the operators ; & && and ; is used to simply execute commands in

More information

COMS 3101 Programming Languages: Perl. Lecture 1

COMS 3101 Programming Languages: Perl. Lecture 1 COMS 3101 Programming Languages: Perl Lecture 1 Fall 2013 Instructor: Ilia Vovsha http://www.cs.columbia.edu/~vovsha/coms3101/perl What is Perl? Perl is a high level language initially developed as a scripting

More information

Perl for Biologists. Session 13 May 27, Parallelization with Perl. Jaroslaw Pillardy

Perl for Biologists. Session 13 May 27, Parallelization with Perl. Jaroslaw Pillardy Perl for Biologists Session 13 May 27, 2015 Parallelization with Perl Jaroslaw Pillardy Perl for Biologists 1.2 1 Session 12 Exercises Review 1. Write a script that checks for new versions of a set of

More information

Examples of Using the ARGV Array. Loop Control Operators. Next Operator. Last Operator. Perl has three loop control operators.

Examples of Using the ARGV Array. Loop Control Operators. Next Operator. Last Operator. Perl has three loop control operators. Examples of Using the ARGV Array # mimics the Unix echo utility foreach (@ARGV) { print $_ ; print \n ; # count the number of command line arguments $i = 0; foreach (@ARGV) { $i++; print The number of

More information

Optimization. Benchmark. simple use as timer. Biol Practical Biocomputing 1

Optimization. Benchmark. simple use as timer. Biol Practical Biocomputing 1 Optimization Benchmark simple use as timer use Benchmark; $t0 = Benchmark->new; #... your code here... $t1 = Benchmark->new; $td = timediff($t1, $t0); print "the code took:",timestr($td),"\n"; Biol 59500-033

More information

Objektorienteeritud programmeerimine MTAT (6 EAP) 9. Loeng. H e l le H e i n h e l l e. h ee

Objektorienteeritud programmeerimine MTAT (6 EAP) 9. Loeng. H e l le H e i n h e l l e. h ee Objektorienteeritud programmeerimine MTAT.03.130 (6 EAP) 9. Loeng H e l le H e i n h e l l e. h ein@ut. ee Täna loengus: Erindid Erindite töötlemine Võtmesõnad try, catch, throw, throws, finally, assert

More information

8/13/ /printqp.php?heading=II BSc [ ], Semester III, Allied: COMPUTER PROGRAMMING-PERL -309C&qname=309C

8/13/ /printqp.php?heading=II BSc [ ], Semester III, Allied: COMPUTER PROGRAMMING-PERL -309C&qname=309C Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated 'A'

More information

1 Output and static... variables 2 Modifying variables Sophisticated... variables: arrays 4 Sophisticated...

1 Output and static... variables 2 Modifying variables Sophisticated... variables: arrays 4 Sophisticated... Contents I Table of Contents Part I Document Overview 2 Part II What is Perl? 3 Part III Getting Started with Simple Examples 4 1 Output and static... variables 4 2 Modifying variables... 4 3 Sophisticated...

More information

File System User API

File System User API File System User API Blunk Microsystems file system API includes the file-related routines from Standard C and POSIX, as well as a number of non-standard functions that either meet a need unique to embedded

More information

Perl for Biologists. Arrays and lists. Session 4 April 2, Jaroslaw Pillardy. Session 4: Arrays and lists Perl for Biologists 1.

Perl for Biologists. Arrays and lists. Session 4 April 2, Jaroslaw Pillardy. Session 4: Arrays and lists Perl for Biologists 1. Perl for Biologists Session 4 April 2, 2014 Arrays and lists Jaroslaw Pillardy Session 4: Arrays and lists Perl for Biologists 1.1 1 if statement if(condition1) statement; elsif(condition2) statement;

More information

# program uses modules nmap::parser and Data::Validate::IP use Nmap::Parser; use Data::Validate::IP qw(is_ipv4 is_ipv6);

# program uses modules nmap::parser and Data::Validate::IP use Nmap::Parser; use Data::Validate::IP qw(is_ipv4 is_ipv6); #!/usr/bin/perl -w use strict; # # usage: final.pl [ip address / range] # # This program scans a host or a range of hosts to see if they are vulnerable to # the MS08_067 or MS10_061 exploits. If they are,

More information

Mälu interfeisid Arvutikomponendid Ergo Nõmmiste

Mälu interfeisid Arvutikomponendid Ergo Nõmmiste Mälu interfeisid Arvutikomponendid Ergo Nõmmiste Mälu liigid Read-only memory (ROM) Flash memory (EEPROM) Static random access memory (SRAM) Dynamic random access memoty (DRAM) 1 kbaidine mälu vajab 10

More information

# put all aligments together from one single original read

# put all aligments together from one single original read #!/usr/bin/perl open(file, "accepted_hits_sorted.sam") or die("unable to open file"); open(output, ">final- alignment.sam") or die("unable to open file"); use strict; my $i; my $line; my $line1; my @group;

More information

Programmeerimise 2. vaheeksam

Programmeerimise 2. vaheeksam Programmeerimise 2. vaheeksam 5. jaanuar 2015, kell 10:00 13:00 1. Fraktal (3p) yl1.py Kõrvaloleval pildil on fraktali 1., 2., 3. ja 4. taseme näidised. Kirjuta rekursiivne funktsioon, mis võtab argumendiks

More information

CS4500/5500 Operating Systems File Systems and Implementations

CS4500/5500 Operating Systems File Systems and Implementations Operating Systems File Systems and Implementations Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang UC. Colorado Springs Recap of Previous Classes Processes and threads o Abstraction

More information

Perl Primer An Introduction to Perl for C++ Programmers by Frank McCown and Tim Baird Harding University

Perl Primer An Introduction to Perl for C++ Programmers by Frank McCown and Tim Baird Harding University Perl Primer An Introduction to Perl for C++ Programmers by Frank McCown and Tim Baird Harding University PERL is the Practical Extraction and Report Language (or Pathologically Eclectic Rubbish Lister)

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

This is a list of questions and answers about Unicode in Perl, intended to be read after perlunitut.

This is a list of questions and answers about Unicode in Perl, intended to be read after perlunitut. NAME Q and A perlunifaq - Perl Unicode FAQ This is a list of questions and answers about Unicode in Perl, intended to be read after perlunitut. perlunitut isn't really a Unicode tutorial, is it? No, and

More information

bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017

bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 Command Lists A command is a sequence of commands separated by the operators ; & && and ; is used to simply execute commands in

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

PERL MOCK TEST PERL MOCK TEST II

PERL MOCK TEST PERL MOCK TEST II http://www.tutorialspoint.com PERL MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Perl. You can download these sample mock tests at your local machine

More information

2017/11/20 20:24 1/2 Väljatrükkide häälestamine

2017/11/20 20:24 1/2 Väljatrükkide häälestamine 2017/11/20 20:24 1/2 Väljatrükkide häälestamine Sisukord Väljatrükkide häälestamine... 1 Häälestamine... 1 Parameetrid XSLis... 1 XSLi parameetri kasutuse näited... 2 Ribakood pildina... 2 Code128 ribakoodi

More information

Programming introduction part I:

Programming introduction part I: Programming introduction part I: Perl, Unix/Linux and using the BlueHive cluster Bio472- Spring 2014 Amanda Larracuente Text editor Syntax coloring Recognize several languages Line numbers Free! Mac/Windows

More information

Robot iehit amise j uhend Mikrokont rolleri programmeerimine C keeles Põhiline C keelest

Robot iehit amise j uhend Mikrokont rolleri programmeerimine C keeles Põhiline C keelest Robot iehit amise j uhend Mikrokont rolleri programmeerimine C keeles Põhiline C keelest Autorid: Alar Ainla Alvo Aabloo Tartu Ülikool Juhendi koostamist on toetanud EITSA SISUKORD SISUKORD 2 SISSEJUHATUS

More information

Salvestusseadmed ja kettahaldus

Salvestusseadmed ja kettahaldus Salvestusseadmed ja kettahaldus 1. slaid Salvestusseadmed Lindid Kettad Välkmäluseadmed (flash memory) 2. slaid Lindid Lindiseadmeid kasutati esmalt salvestusseadmena Lindilt andmete kätte saamine on aeglane

More information

IT441. Network Services Administration. Perl: File Handles

IT441. Network Services Administration. Perl: File Handles IT441 Network Services Administration Perl: File Handles Comment Blocks Perl normally treats lines beginning with a # as a comment. Get in the habit of including comments with your code. Put a comment

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

class implementing objects of the correct type. Any additional arguments in the LIST are passed to

class implementing objects of the correct type. Any additional arguments in the LIST are passed to NAME perltie - how to hide an object class in a simple variable SYNOPSIS tie VARIABLE, CLASSNAME, LIST $object = tied VARIABLE DESCRIPTION Tying Scalars untie VARIABLE Prior to release 5.0 of Perl, a programmer

More information

Processes and Shells

Processes and Shells Shell ls pico httpd CPU Kernel Disk NIC Processes Processes are tasks run by you or the OS. Processes can be: shells commands programs daemons scripts Shells Processes operate in the context of a shell.

More information

UNIX System Programming Lecture 3: BASH Programming

UNIX System Programming Lecture 3: BASH Programming UNIX System Programming Outline Filesystems Redirection Shell Programming Reference BLP: Chapter 2 BFAQ: Bash FAQ BMAN: Bash man page BPRI: Bash Programming Introduction BABS: Advanced Bash Scripting Guide

More information

The svn-multi.pl Script

The svn-multi.pl Script The svn-multi.pl Script Martin Scharrer martin@scharrer-online.de http://latex.scharrer-online.de/svn-multi CTAN: http://tug.ctan.org/pkg/svn-multi Version 0.1a July 26, 2010 Note: This document is work

More information

EECS402. PERL Basics

EECS402. PERL Basics The University Of Michigan PERL Basics Andrew M Morgan Reading: Programming Perl by Wahl, Christiansen, Schwartz (O'Reilly And Associates) Scripts Oftentimes, you will hear someone say "Oh, I'll just write

More information

Ruby Topic Maps. Introduction to Ruby. Benjamin Bock.

Ruby Topic Maps. Introduction to Ruby. Benjamin Bock. Ruby Topic Maps http://rtm.rubyforge.org Introduction to Ruby Benjamin Bock 1 Calculator irb(main):001:0> 1+2 Type irb in your Terminal / Command / Shell window to start the interactive Ruby interpreter

More information

The Unix Shell. Pipes and Filters

The Unix Shell. Pipes and Filters The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd

More information

Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed.

Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed. Some UNIX Commands at at time [day] [file] Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed. Often used to do time-consuming

More information

ABIMATERJAL ROBOOTIKA TÖÖVIHIKULE Algoritmid ja programmeerimine

ABIMATERJAL ROBOOTIKA TÖÖVIHIKULE Algoritmid ja programmeerimine Raivo Sell, Mikk Leini ABIMATERJAL ROBOOTIKA TÖÖVIHIKULE Algoritmid ja programmeerimine Robootika Kodulabori baasil Kujundus ja küljendus: Raivo Sell Arvutigraafika: Raivo Sell Keeletoimetus: Airi Veber

More information

Kirje. Kirje. Tüpiseeritud fail. CASE-lause. Laiendatud klahvikoodid. 1

Kirje. Kirje. Tüpiseeritud fail. CASE-lause. Laiendatud klahvikoodid. 1 Kirje. Tüpiseeritud fail. CASE-lause. Laiendatud klahvikoodid. 1 Kirje Kirje (record) on struktuurne andmetüüp (nagu massiiv) erinevat tüüpi andmete gruppeerimiseks. Kirje koosneb väljadest (field). Iga

More information

Java põhikursuse konspekt

Java põhikursuse konspekt Tallinna Pedagoogikaülikool Informaatika osakond Jaagup Kippar Java põhikursuse konspekt Tallinn 2003 Sissejuhatus Käesolev kirjutis on mõeldud nii iseõppijatele kui abimaterjaliks õpilastele ja õpetajatele.

More information

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 More Scripting and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 Regular Expression Summary Regular Expression Examples Shell Scripting 2 Do not confuse filename globbing

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

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple proces

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple proces File systems 1 Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple processes must be able to access the information

More information

LING/C SC/PSYC 438/538. Lecture 6 Sandiway Fong

LING/C SC/PSYC 438/538. Lecture 6 Sandiway Fong LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong Today s Topic Homework 2 out today due next Thursday by midnight submit one file only (preferably PDF) Subject line: Your Name 538/438 Homework 2 Perl Recap

More information

Chapter 7. - FORTRAN I control statements were based directly on IBM 704 hardware

Chapter 7. - FORTRAN I control statements were based directly on IBM 704 hardware Levels of Control Flow: 1. Within expressions 2. Among program units 3. Among program statements Evolution: - FORTRAN I control statements were based directly on IBM 704 hardware - Much research and argument

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

2.3 Unix Streaming and Piping

2.3 Unix Streaming and Piping 2.3 Unix Streaming and Piping In addition to streams explicitly opened by applications, the Unix system provides you with 3 special streams: stdin (standard input): This stream is usually connected to

More information

Intermediate Perl. Boston University Information Services & Technology. Course Coordinator: Timothy Kohl

Intermediate Perl. Boston University Information Services & Technology. Course Coordinator: Timothy Kohl Intermediate Perl Boston University Information Services & Technology Course Coordinator: Timothy Kohl Last Modified: 09/19/13 Outline explore further the data types introduced before. introduce more advanced

More information

CMSC 330: Organization of Programming Languages. Ruby Regular Expressions

CMSC 330: Organization of Programming Languages. Ruby Regular Expressions CMSC 330: Organization of Programming Languages Ruby Regular Expressions 1 String Processing in Ruby Earlier, we motivated scripting languages using a popular application of them: string processing The

More information

CSE 333 SECTION 3. POSIX I/O Functions

CSE 333 SECTION 3. POSIX I/O Functions CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the

More information

This file is copyright 2006 Mark Jason Dominus. Unauthorized distribution in any medium is absolutely forbidden. Domain Zone Checking.

This file is copyright 2006 Mark Jason Dominus. Unauthorized distribution in any medium is absolutely forbidden. Domain Zone Checking. This file is copyright 2006 Mark Jason Dominus. Unauthorized distribution in any medium is absolutely forbidden. 1. Date Formatting 2. The Main Loop 3. Skipping Duplicate Items 4. Loop Hoisting 5. File-Scope

More information

file:///export/home/apostolo/work/tex/mkindex/mkgrki...

file:///export/home/apostolo/work/tex/mkindex/mkgrki... The correct generation and typesetting of an index for a Greek document prepared with LaTeX is not a trivial task at all. First of all, the program makeindex cannot handle Greek letters, but even if the.idx

More information