Perl 2 Intermediate Perl O Reilly

Perl 2 Intermediate Perl O Reilly-Free PDF

  • Date:16 Feb 2020
  • Views:96
  • Downloads:0
  • Pages:154
  • Size:1.19 MB

Share Pdf : Perl 2 Intermediate Perl O Reilly

Download and Preview : Perl 2 Intermediate Perl O Reilly


Report CopyRight/DMCA Form For : Perl 2 Intermediate Perl O Reilly


Transcription:

Alternatio n,Co mplete Parsing,Quiz 1 Pro ject 1,Lesso n 9 Int ro duct io n t o One Line rs. Perl at the Co mmand Line,The e Flag,The n Flag,BEGIN and END blo cks. Quiz 1 Pro ject 1,Lesso n 10 Subst it ut io n and Mo re One Line rs. Substitutio n,Substitutio n in One liners,The p Flag. The i Flag,Quiz 1 Pro ject 1, Lesso n 11 Mo re Pe rl Flags Mo re Pe rl Ope rat o rs.
The w Flag,The Mstrict Flag,The c Flag,The Trinary Operato r. Nesting the Trinary Operato r,The Trinary Operato r as Lvalue. The Scalar Range Operato r,Quiz 1 Pro ject 1, Lesso n 12 Mo re o n Num be rs and St rings Mo re o n Re gular Expre ssio ns Mo re o n Hashe s. String and Number Literals,Character Functio ns,Number Functio ns. Hashes each,Quiz 1 Pro ject 1, Lesso n 13 Fo r Lo o ps and Mo re Misce llane o us T o pics.
Fo r Lo o ps,Lo o p Labels,Unbuffered Output,Quiz 1 Pro ject 1. Lesso n 14 Dire ct o ry Re ading Funct io ns,o pendir readdir clo sedir. Quiz 1 Pro ject 1, Lesso n 15 Mo re Mat h Funct io ns and Co urse Wrap Up. Mo re Math Functio ns,Final Example Pro gram,Quiz 1 Pro ject 1. Copyright 1998 2014 O Reilly Media Inc, This work is licensed under a Creative Commons Attribution ShareAlike 3 0 Unported License.
See http creativecommons org licenses by sa 3 0 legalcode for more information. Getting Started, Welco me to the O Reilly Scho o l o f Techno lo gy s Perl 2 Intermediate Perl co urse. Course Objectives, When yo u co mplete this co urse yo u will be able to. create practical pro grams that interact with the user and the o perating system. perfo rm useful and impo rtant tasks witho ut even writing pro grams by calling Perl fro m the co mmand line with brief. o ne liners, match and change text using the po werful techno lo gy o f regular expressio ns. enhance so ftware quality with a larger reperto ire o f Perl o perato rs functio ns and lo o ping co nstructs. Introduction, Hello my name is Peter Sco tt and I have been using and teaching Perl fo r o ver a do zen years I m the autho r o f the. bo o ks Perl Debugged and Perl Medic and the DVD video Perl Fundamentals I ve taught Perl in perso n to hundreds o f. peo ple and I am also the autho r o f the Perl 1 co urse fro m OST I lo ve Perl and I want yo u to enjo y yo ur time spent. learning mo re abo ut Perl fro m this co urse Please let yo ur instructo r kno w o f any way in which yo u think this co urse. co uld be impro ved and also parts that yo u fo und particularly effective so we kno w no t to mess with tho se bits. Learning with O Reilly School of T echnology Courses. As with every O Reilly Scho o l o f Techno lo gy co urse we ll take a user active appro ach to learning This means that yo u. the user will be active Yo u ll learn by do ing building live pro grams testing them and experimenting with them. To learn a new skill o r techno lo gy yo u have to experiment The mo re yo u experiment the mo re yo u learn Our system. is designed to maximize experimentatio n and help yo u learn to learn a new skill. We ll pro gram as much as po ssible to be sure that the principles sink in and stay with yo u. Each time we discuss a new co ncept yo u ll put it into co de and see what YOU can do with it On o ccasio n we ll even. give yo u co de that do esn t wo rk so yo u can see co mmo n mistakes and ho w to reco ver fro m them Making mistakes. is actually ano ther go o d way to learn, Abo ve all we want to help yo u to learn to learn We give yo u the to o ls to take co ntro l o f yo ur o wn learning experience.
When yo u co mplete an OST co urse yo u kno w the subject matter and yo u kno w ho w to expand yo ur kno wledge so. yo u can handle changes like so ftware and o perating system updates. Here are so me tips fo r using O Reilly Scho o l o f Techno lo gy co urses effectively. T ype t he co de Resist the temptatio n to cut and paste the example co de we give yo u Typing the co de. actually gives yo u a feel fo r the pro gramming task Then play aro und with the examples to find o ut what else. yo u can make them do and to check yo ur understanding It s highly unlikely yo u ll break anything by. experimentatio n If yo u do break so mething that s an indicatio n to us that we need to impro ve o ur system. T ake yo ur t im e Learning takes time Rushing can have negative effects o n yo ur pro gress Slo w do wn and. let yo ur brain abso rb the new info rmatio n tho ro ughly Taking yo ur time helps to maintain a relaxed po sitive. appro ach It also gives yo u the chance to try new things and learn mo re than yo u o therwise wo uld if yo u. blew thro ugh all o f the co ursewo rk to o quickly. Expe rim e nt Wander fro m the path o ften and explo re the po ssibilities We can t anticipate all o f yo ur. questio ns and ideas so it s up to yo u to experiment and create o n yo ur o wn Yo ur instructo r will help if yo u. go co mpletely o ff the rails, Acce pt guidance but do n t de pe nd o n it Try to so lve pro blems o n yo ur o wn Go ing fro m. misunderstanding to understanding is the best way to acquire a new skill Part o f what yo u re learning is. pro blem so lving Of co urse yo u can always co ntact yo ur instructo r fo r hints when yo u need them. Use all available re so urce s In real life pro blem so lving yo u aren t bo und by false limitatio ns in OST. co urses yo u are free to use any reso urces at yo ur dispo sal to so lve pro blems yo u enco unter the Internet. reference bo o ks and o nline help are all fair game. Have f un Relax keep practicing and do n t be afraid to make mistakes Yo ur instructo r will keep yo u at it. until yo u ve mastered the skill We want yo u to get that satisfied I m so co o l I did it feeling And yo u ll have. until yo u ve mastered the skill We want yo u to get that satisfied I m so co o l I did it feeling And yo u ll have. so me pro jects to sho w o ff when yo u re do ne,Lesson Format. We ll try o ut lo ts o f examples in each lesso n We ll have yo u write co de lo o k at co de and edit existing co de The co de. will be presented in bo xes that will indicate what needs to be do ne to the co de inside. Whenever yo u see white bo xes like the o ne belo w yo u ll type the co ntents into the edito r windo w to try the example. yo urself The CODE TO TYPE bar o n to p o f the white bo x co ntains directio ns fo r yo u to fo llo w. CODE TO TYPE, White boxes like this contain code for you to try out type into a file to run. If you have already written some of the code new code for you to add looks like this. If we want you to remove existing code the code to remove will look like this. We may also include instructive comments that you don t need to type. We may run pro grams and do so me o ther activities in a terminal sessio n in the o perating system o r o ther co mmand. line enviro nment These will be sho wn like this,INTERACTIVE SESSION. The plain black text that we present in these INTERACTIVE boxes is. provided by the system not for you to type The commands we want you to type look lik. Co de and info rmatio n presented in a gray OBSERVE bo x is fo r yo u to inspect and absorb This info rmatio n is o ften. co lo r co ded and fo llo wed by text explaining the co de in detail. Gray Observe boxes like this contain information usually code specifics for you to. The paragraph s that fo llo w may pro vide additio n details o n inf o rm at io n that was highlighted in the Observe bo x. We ll also set especially pertinent info rmatio n apart in No te bo xes. Note No tes pro vide info rmatio n that is useful but no t abso lutely necessary fo r perfo rming the tasks at hand. T ip Tips pro vide info rmatio n that might help make the to o ls easier fo r yo u to use such as sho rtcut keys. WARNING Warnings pro vide info rmatio n that can help prevent pro gram crashes and data lo ss. T he CodeRunner Screen, This co urse is presented in Co deRunner OST s self co ntained enviro nment We ll discuss the details later but here s.
a quick o verview o f the vario us areas o f the screen. These video s explain ho w to use Co deRunner,File Management Demo. Co de Edito r Demo,Co ursewo rk Demo,Prerequisites. We assume and require that yo u have either taken o ur Perl 1 co urse o r have acquired the kno wledge imparted by that. co urse so me o ther way We ll spend so me time in this lesso n reviewing tho se prerequisites Of co urse we can t. review them co mpletely it to o k 16 lesso ns in Perl 1 to co ver them But we ll give it o ur best sho t. The next sectio n is a detailed review o f the to pics co vered in the Perl 1 co urse we reco mmend go ing thro ugh it as a. refresher but if yo u ve taken Perl 1 recently o r o therwise feel yo u do n t need the review yo u can skip to the next. sectio n Po stfixed Mo difiers, If yo u find as yo u review tho se prerequisites and the rest o f this lesso n that yo u re no t sure yo u re ready fo r this. co urse do n t wo rry it happens Do n t give up but do n t try to struggle thro ugh the co urse if yo u re no t sufficiently. prepared We re happy to transfer yo ur registratio n to the Perl 1 co urse so yo u can get well gro unded in the. fundamentals o f Perl Just co ntact us at info o reillyscho o l co m. Here s what yo u sho uld kno w already in o rder to co mplete this co urse successfully Fo r each o f these to pics. yo u need to kno w o nly the basics we ll develo p these to pics in mo re depth during this co urse. Fo r instance we require that yo u kno w ho w to declare a scalar variable and manipulate scalars co ntaining. strings and numbers but this do es no t extend to handling patho lo gically lo ng strings o r understanding the. internal structure o f scalars,OBSERVE scalar initializatio n. my dog Spot, If yo u kno w what this co de means that s eno ugh o n the to pic o f initializatio n fo r this co urse.
De ve lo pm e nt and Exe cut io n Yo u understand ho w to create edit and run a Perl pro gram We ll sho w. yo u ho w the specialized training enviro nment we use in this co urse wo rks but yo u sho uld have develo ped. and run Perl pro grams so mewhere else at least o nce Yo u kno w abo ut the shebang line and yo u fo llo w it. with use st rict and use warnings and yo u do no t finalize any pro gram that o utputs erro rs o r warnings. Yo u kno w that co mmand line arguments arrive in the array ARGV. Do cum e nt at io n Yo u kno w abo ut the perldoc pro gram and ho w to find the do cumentatio n fo r any given. Perl built in functio n,perldoc f join, Out put and e rro rs Yo u have used the functio ns print warn and die yo u can print to the standard o utput. o r erro r stream and yo u can make yo ur pro gram quit with an erro r message. OBSERVE o utput and basic erro r handling,print I have song count MP3 files. die Error in consistency check, Let s start ro lling these review po ints into a pro gram no w so that yo u have so mething to do. First we ll create a fo lder to keep all o f o ur Perl stuff o rganized In the left panel o f yo ur Co deRunner windo w. right click Ho m e and select Ne w f o lde r as sho wn. Name the fo lder pe rl2 as sho wn, Lo cate the dro p do wn menu in the Co deRunner to o lbar Be sure that Pe rl is the Synt ax selected fro m this. Yo u sho uld no w see a ico n o n the left side o f the to o lbar. In the edito r type do n t just cut and paste all the lines yo u see belo w so it lo o ks like this. CODE TO TYPE review pl,usr bin perl,use strict,use warnings.
die This is a very short program I only have time to arrgh. Co mpile the pro gram Click A new windo w will o pen where yo u can name and save the. file Select the pe rl2 fo lder yo u just created save all yo ur files here unless o therwise specified enter the file. name re vie w pl and click Save, If the pe rl2 fo lder do esn t yet exist right click o n the Ho m e fo lder and create it by clicking Ne w Fo lde r. Click the Save butto n Yo u ll see a message co nfirming that the pro gram co mpiled and syntax is OK Go. ahead and Clo se this windo w, No w let s run the pro gram Click the Ne w T e rm inal butto n in the To o lbar. Then lo g in to the OST server Be sure to replace use rnam e with yo ur username It sho uld lo o k so mething. INTERACTIVE TERMINAL SESSION,login username, Last login Mon Aug 16 11 36 41 from 63 171 219 110. When yo u enter yo ur passwo rd the curso r will no t mo ve In fact it will no t appear as tho ugh. Note anything is happening Rest assured it is Just be sure to type yo ur passwo rd carefully and hit. Enter If yo u are having tro uble please co ntact yo ur mento r. The server is named co ld All OST students have shells o n this server A she ll is the place where yo u. execute Unix co mmands o n the server The co mmands yo u execute o n yo ur shell will no t effect any o ther. co ld is called a co mmand pro mpt If yo u see this yo u re ready to execute Unix co mmands To run yo ur. pro gram go to the Unix pro mpt and call it by name. INTERACTIVE TERMINAL SESSION,cold cd perl2,cold perl2 review pl. This is a very short program I only have time to arrgh. Int e rpo lat io n Yo u kno w abo ut interpo lating scalars and the mo re co mmo n escape sequences inside. do uble quo ted strings,print I have song count MP3 files n.
Fo rm at t e d print ing Yo u can print numbers and strings fo rmatted to fit co lumns in tabular o utput using the. print f functio n,printf I have 3d MP3 files n 13, Variable de clarat io n and init ializat io n Yo u. books Perl Debugged and Perl Medic and the DVD video Perl Fundamentals I ve taught Perl in person to hundreds of people and I am also the author of the Perl 1 course from OST I love Perl and I want you to enjoy your time spent learning more about Perl from this course Please let your instructor know of any way in which you think this course

Related Books