Cov txheej txheem:
- Kauj Ruam 1: Cov Khoom Siv
- Kauj Ruam 2: Koj Thawj Txoj Haujlwm
- Kauj ruam 3: Variables
- Kauj Ruam 4: Tau Txais Ntau Ntxiv
- Kauj Ruam 5: Lwm Qhov Siv thiab Looping
- Kauj ruam 6: Boolean
- Kauj Ruam 7: Muab Nws Ua Ke
- Kauj ruam 8: Ua tiav
Video: Kawm Perl Yooj Yim rau Nruab Nrab: 8 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
Perl yog cov ntawv nyeem raws li kev sau ntawv languge uas muaj nws qhov zoo thiab qhov tsis zoo, qhov kev qhia no yuav muab koj cov ntsiab lus ntawm cov hauv paus thiab kev ua haujlwm uas feem ntau cov kws sau ntawv (AKA; programers)
yuav siv. QHOV TSEEM CEEB! (rau lub qhov rais ua haujlwm nkaus xwb) Kuv tab tom kwv yees tias koj tau ua haujlwm nrog lub ntiaj teb nyob zoo program ua ntej lossis/thiab ua haujlwm nrog tus cuam tshuam. thaum sau ntawv hauv perl koj yuav tsum hloov koj PATH, tab sis yog tias koj tsis xav ua qhov no, siv perl nthuav qhia (qhia hauv qab no). *ceeb toom plese tus nqi thiab tawm tswv yim qhia no
Kauj Ruam 1: Cov Khoom Siv
1.a perl interpeter (google nws!)
2.if koj xav tau, perl nthuav qhia (google nws!) 3.yog li, yog tias koj xav tau, modules (google perl modules rau qee qhov) nruab cov modules hauv "lib" nplaub tshev hauv koj phau ntawv teev npe perl interpeter
Kauj Ruam 2: Koj Thawj Txoj Haujlwm
ok cia ua qhov program yooj yim, theej thiab muab qhov #!/usr/bin/perl sau "nyob zoo ntiaj teb"; qhov ntawd yog txoj haujlwm yooj yim tshaj plaws uas koj tuaj yeem ua, yog tias koj xav ntxiv rau nws me ntsis, ntaus #!/usr/bin/perl print "nyob zoo / n ntiaj teb"; koj tau ua koj thawj qhov haujlwm!, / n yog los ua kab tshiab tam sim no cia kom tau txais qib me ntsis ntxiv
Kauj ruam 3: Variables
tam sim no muaj peb hom kev hloov pauv, 1.scalers (tuav ib kab ntawm cov ntaub ntawv) (($ scaler lub npe = tus nqi;) 2.arrays (tuav ntau daim kab xev ntawm cov ntaub ntawv) ((@array name = (values);) 3. hashes %hashname = (tus nqi => lwm tus nqi, tus nqi => lwm tus nqi #suav nrog ntau ntawm cov theses raws li koj xav tau)
Kauj Ruam 4: Tau Txais Ntau Ntxiv
cia ua cov ntawv sau uas luam tawm qhov tseem ceeb ntawm kev hloov pauv, ntaus cov ntawv no! (koj tsis tas yuav sau cov lus pom, cov lus pom tau sau nrog #) 1. #!/usr/bin/perl $ variablename = 5; sau "$ variablename"; 2. #!/usr/bin/perl @arrayname = (tus nqi, tus nqi 2); #nco ntsoov, koj yuav tsum xa mus rau arrays raws li piv txwv piv txwv (qhov ntsuas tau nyob rau hauv kev txiav txim pib ntawm xoom luam tawm "$ arrayname {0} n"; #print tus nqi sau "$ arrayname {1} n"; #print value2 note: rau cov cai saum toj no {thiab} cov cim yog qhov ua piv txwv kab zauv 3. #!/usr/bin/perl kuv %hash = (v => tus nqi, v2 => tus nqi 2); luam tawm $ hash {v}; tam sim no cia kawm paub lwm qhov siv rau scalers, ntaus lossis luam thiab muab cov lej no #!/usr/bin/perl $ scalername =; luam tawm $ scalername; ntaus txhua yam koj xav tau thaum siv qhov hais kom ua sai tab sis yog tias koj siv perl nthuav qhia, nyem rau std.input ces nyem rau ntawm i/o cim cim cia cia pom qee qhov kev siv ntau ntxiv rau cov lej
Kauj Ruam 5: Lwm Qhov Siv thiab Looping
theej thiab muab cov cai no #!/usr/bin/perl $ scalername =; yog ($ scalername = ~ m/bill clinton/) {print "nws clinton zoo lawm!"; } ua li cas, koj yuav nug "ua li cas yog tias ua?" nqes mus thiab koj yuav pom! >>>>>>>> hauv qhov yog tias kev cai lij choj perl coj tus cwj pwm zoo li hauv qab no, perl nug "puas yog $ scalername muaj daim nqi clinton? "ntawm no yog lwm txoj haujlwm uas tseem siv tau ntau yam thaum ua piv txwv: luam thiab muab cov cai no #!/usr/bin/perl $ a = 1; thaum ($ a == 1) # == yog rau cov lej nkaus xwb {print "a = 1"; } lwm {print "a tsis sib npaug 1"; } cov kauj ruam tom ntej yuav tham txog kev ua haujlwm boolean
Kauj ruam 6: Boolean
boolean yog rau cov lej nkaus xwb! heres qee qhov haujlwm ==, sib npaug! =, tsis sib npaug <, ntau dua>, tsawg dua (*), suav ntau ntxiv: hauv kev sib npaug tsis muaj () 's +, ntxiv
Kauj Ruam 7: Muab Nws Ua Ke
theej thiab muab tus lej no, #!/usr/bin/perl $ ua haujlwm =; yog ($ ua haujlwm = ~ m/sib npaug/) {luam tawm "sau tus lej: / n"; $ a =; luam "sau tus lej rau sib npaug $ a: / n "; $ b =; $ c = $ a * $ b; luam tawm" $ a sib npaug los ntawm $ b = $ c / n ";} yog ($ ua haujlwm = ~ m/ntxiv/) {luam tawm "sau tus lej: / n"; $ a =; luam "sau tus lej ntxiv rau $ a: / n"; $ b =; $ c = $ a + $ b; luam "$ ntxiv rau $ b = $ c / n ";}
Kauj ruam 8: Ua tiav
thaum koj sau koj tus kheej cov haujlwm koj yuav xav ntxiv qhov haujlwm no hauv koj cov cai
siv ceeb toom; ok koj ua tau!
Pom zoo:
Nruab Nrab Nruab Nrab Chav Dej Teeb: 5 Kauj Ruam (nrog Duab)
Nruab Nrab Nruab Nrab Chav Dej Teeb: Peb ib txhia ntsib kev xav tau siv chav dej nyob nruab nrab hmo ntuj. Yog tias koj qhib lub teeb, tej zaum koj yuav tsis pom kev hmo ntuj. Lub teeb dawb lossis xiav ua rau koj plam qhov pw tsaug zog lawm, Melatonin, ua rau nws nyuaj rau rov mus pw. Yog li
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
LED Teeb Nruab Nrab Nruab Nrab: 13 Kauj Ruam
LED Teeb Nruab Nrab Nruab Nrab: Kuv tau hla cov khoom hu ua LED nplaim taws. Thaum taug kev tsis muaj phiaj xwm nyob ib puag ncig hauv is taws nem, thiab xav tias qhov no tuaj yeem ua rau lub tsaj nruab nrab nruab nrab zoo nkauj uas yog nplaim taws nyab xeeb thiab nqa mus ib puag ncig txawm tias nyob hauv LARP
Lub GoodNightLight: Lub Teeb Nruab Nrab Nruab Nrab Yooj Yim: 5 Kauj Ruam
Qhov GoodNightLight: Lub Teeb Nruab Nrab Nruab Nrab: Nyob zoo txhua tus, Kuv qhia Bioinstrumentation chav kawm rau cov tub ntxhais kawm theem nrab thaum lub caij ntuj no ua ib feem ntawm Purdue GERI (Lub Tsev Kawm Ntawv Muaj Txuj Ci Kev Kawm). Hauv chav kawm no, Kuv qhia cov tub ntxhais kawm txog cov hauv paus ntawm kev siv hluav taws xob thiab seb peb siv cov khoom siv hluav taws xob li cas hauv Biomedical Eng
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi