Introduction to Perl Programming Boston University

Introduction To Perl Programming Boston University-Free PDF

  • Date:05 Apr 2020
  • Views:78
  • Downloads:1
  • Pages:70
  • Size:262.17 KB

Share Pdf : Introduction To Perl Programming Boston University

Download and Preview : Introduction To Perl Programming Boston University


Report CopyRight/DMCA Form For : Introduction To Perl Programming Boston University


Transcription:

I A few introductory notes,II About Perl and programming. III Perl basics,IV Variables,V Conditionals and loops. VI Exercises,VII More stuff, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 2. I A few introductory notes, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 3. I m a linguist I have no formal background in,computer science If you have difficult.
questions about computer science ask Paul,I do know how to program quite well in Perl. but I am not an expert There are many many,things you can do with Perl and I have learned. only a small subset of these, Having said that feel free to ask me things if you. think I can help with your exercises, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 4. Nomenclature,Here are some terms that are used pretty much.
interchangeably in this presentation Don t let this. confuse you,script program,coding programming,execute run. evaluate test, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 5. Formatting,Normal expository text is in this font,Text that represents what you type is shown like. perl myprogram pl,Text that represents computer output on the. screen is shown like so,File not found,Things written in angle brackets should be.
replaced with the appropriate text,perl your program w. Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 6. II About Perl and,programming, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 7. What is Perl,Perl is an interpreted programming language. More on what that means soon,Any programming language is essentially a. human friendly formalism for writing instructions, for a computer to follow These instructions are at.
some point translated into machine language,which is what the computer really understands. Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 8. Programming languages vs,human languages, Since we re all linguists it s interesting to think for. a moment about the differences between,computer languages and natural languages. Most programming languages do have recursive syntax. and thus can theoretically generate infintely complex. structures like human language,Also programming languages have syntax and. semantics and something akin to word classes, However programming languages have extremely small.
lexicons and very restricted syntactic rules, Another big difference is that computer languages deal. with very restricted domains compared to human, languages which are much more general and flexible. Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 9. Programming languages vs,human languages,Importantly computer programs cannot tolerate. ambiguity programs must be absolutely precise, Pragmatics doesn t really enter into the picture a. computer can t figure out what you mean in spite of. what you say i e no implicature, If there is a counter example to this it is probably Perl.
which is extremely adept at doing the right thing with. a limited amount of explicitness in the instructions. Also Perl like COBOL and some other languages was, designed to sound as much as possible like English so. it s relatively user friendly Relatively, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 10. One big difference between writing programs and writing. other sorts of documents is that your programs must. have perfect syntax or they will not work Every little. comma and semicolon is critical, Therefore in writing code it is vital to be absolutely. meticulous Otherwise you will weep and gnash your,teeth and generally not have much fun. On the bright side the syntax is actually really easy. Many many times easier than in any human language, On the even brighter side Perl is a very forgiving.
language that allows for multiple forms of expression. That means that you can say something in various ways. as long as your syntax is correct, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 11. You and your computer,I like to think of it this way. The computer is very energetic,but very very stupid. The computer can do things incredibly fast and, efficiently but it can t do much without being told. exactly how to do it, Imagine the computer could get you a glass of water.
Instead of saying Get me a glass of water no need to. be polite you would have to say something like, Move to the door travelling north east When you reach. the door locate the handle and rotate it counter clockwise. a quarter turn Swing the door towards you moving out of. the way as it approaches Then proceed through the, doorway and east to the kitchen Locate the refrigerator. Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 12. Why write programs,There are many reasons to write your own. programs Some are more obvious than others, 1 Sometimes you can t find pre existing software to do. what you need done, 2 Sometimes it s easier and faster to do something.
yourself than to use pre existing software, 3 Sometimes you want a very high degree of control one. that you can t get with ready made software, 4 You don t want to have to hire someone else to work. with your data or otherwise cede control of your work. 5 Programming can get you very close to your data you. really see them and think about them more than you. might otherwise, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 13. Why write programs, 6 Programming is an enjoyable mental challenge like. crossword puzzles or chess provided you re not in over. your head It s a very creative activity, 7 Programming is extremely satisfying when it works.
You discover a problem imagine a solution write a, bunch of code and the problem is solved It offers a far. greater sense of closure than most activities in our field. 8 Programming skills are reusable languages are pretty. similar and programming can be useful in all sorts of. domains not just linguistic research,9 Your friends will be very impressed. Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 14. Perl vs other,programming languages,Most programming languages such as C C. VisualBasic etc are compiled languages, To run a program you create a text document with the. code run a compiler on it to convert it into machine. code for your OS and then run it,Perl in an interpreted language like Java.
Pascal awk sed Tcl or Smalltalk, To run a program in such a language you create a text. document and tell the interpreter or Virtual Machine to. run it as a program The interpreter checks it compiles. it into machine code and runs it, The 2 step process of interpreted languages makes them. slightly easier to work with You can constantly check. your code by running it after every change, Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 15. in the server directory of the Perl executable very useful Introduction to Perl Programming presentation by Gregory Garretson 12 06 04 Slide 24 A first program

Related Books