100%(1)100% found this document useful (1 vote) 3K views19 pagesSL Unit-3 Notes!
Jntuh Btech 3-2 CSE(AIML)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
+ UNIT-3
\
pet a pepe language which wag oo ginatly deucloped fos
seal moriputal
PHS Wypical use Ye exhacling telormalion fiom a feat file and
fpinting out epost fos conveaitng a Atul file nlo another torn
ws fs become got HES name — ayer the expnession y
* puacticat Exbaction & Repoait Language"
> Progsiams war in peal one carted —peatl scripts, wdheste as
System prrogsarns fo enecude — pert sestiph ome cauied —_pestl p#0gx0m
Scaipting «
>A scxipting or xaipt language is a programming lon quoge pea |
Jpecial stun time envistonment” that automates the Execuon of tasks. |
A Scvipting language con be viewed as a domdin- specie language
for a porticulay envisionment, In case of scalping an application,
Ye Woy Woon at an erlension Language [high-level programming
language].
some OF scstiping languages ke bash, Node js 5 Ruby 5 python, |
pexl. i
¥ ccotipts ond paogaams : t
LA scolipt oF scatipting language 44 & Computer language with a. |
Seses oy commands within a file capable of being executed
i vothout being compiled:
| gemven- side sestip Fing tonquage: = perl, pip & python.
cher -fide Scot pting languages - Jona scstipt:
>A pHogaam on = genesal fe a sequence oF inchuctons so. that
| a computes can perform certain tah:
@ scanned with OKEN Scanner-
| ing danquage. | ip
! Parogeramming danguag | Seotip| a
| %4 | ining
| 4- cownpileat phased 4+ Snlesiprelen based
\ |
, t
J Mtoe syntax and highly toupied| 0 Peduced yr ond “loosely
coupled,
J Convert ad the tod Jo binary | 4+ Run statement
and stun
(Hs Fos big ond comple paegrent| senate code,
S Fast, fos lange wde. fy Fasleon to smatt toe. "
8. exho. mnemony 6 No tha memory
ob “potas pategstamming bnguages 4+ popular Seatipting languages one
one he Cy cat Jove ea ele. ome python
_ Sealing +
she word 'setipl' na computing conlett Tr 84055 ap oginators
of the unix ee the UNIX opexating System the feo tahew
Seaipt? (sequence of — tomimands)
+ Ain opple —matinigh Hypesxtaxd ereeieny one % the taatly
hupesttentt aystems
I
|
|
|
|
I
f+ the assodoled ype ras tanguage allocated the use Jo chine i
| Sequences of attons 49 be atsocated with mouse clicks ov
| roovements ; ond fhese wee Cauted —_Seotipht-
\
|
+ InHauly a Seofpt af a sequence ef commands 4o contl an
opplication sf a davice,
% Scaipfing ae i
ahe Year ‘scvipfing? now a dowd used with thavee llfenent |
mearings : i
tha mew Style P04 tamering hich allows —apphicadions fo be 1
developed much faster than adifional methods
@ scanned with OKEN Scanneri —— 7
[eats le oo 5 proptonring prquenty uses a acoiipling tongtoge to
| nkerconnect olf the shelf" components fat axe dhemselves waiter,
Yn & terwtentional language.
i Applications butt wn dhis way are Sometimes cared que opplicadiony|
ond athe xcatipting tonquage 43 cared a * que Language *
Gr the use of visual asic to develop sur using pae- tat visual |
i Conbot
iw) ating a Sexip fing language fo monipulate » tustomize ond aubmate
the facies a an ectsting aysteen
is
+ Hee, Scotipt Wed tp wrhal an opplitation Hat provider a i
| propptommatia Faeoface fhe apt. |
js the application 24 conthrucked fom anilection of object eohase proper |
i Hea ond metrods axe Exposed to the Sexi ping language.
| a use of client - side Scsiipting and Pynomic HTML to cxeate
i fnttaative wel pages
U8) using a Seafipling tonguage with Ht -xich functionatity ,
|
| we con use on atesndlive to a convenfonal languages for generat
| progeny fame» particularly {Yten progsorming ond systenn
| admin shation. 1
| gr windowr NIT Systeme yses FeRL por adwriviishalfen Apache, har ||
an embedded pel mieoiprtlen for ca? seaiipte. !
Chastackesiisics of s eaipting danguages :
i) Both batch and infestactive use
Suchfle a Jew languages (eg: peri) have a Complies that sequises the
|
entixe —fourte —progetam, almost alt scai’pting languages either Compile
ox interpret ne by fine.
| san» Negmpiied " yesufont - axe actuntty, tomptetely equivalent to
fs he niesipeter Stunning —kehind the Scene.
i
i
@ scanned with OKEN Scanner[« i) €eonomy of tapseation.
| N00 vorifants : some mage heavy use eb puincluation ag short
| fdentifieas, ile chexe —ernghaize “tnglish Khe" tunetionally
| CM) tack A declarations, simple “Seong mules -
while the siules wry, they ae genreaauty feisty Smple and
additional Nyala Ye mecessaoy fo clear them.
| GO Tesible aynange typing
[73.47 PHP python and Ruby, the type of a vasttable “FS mmty checked
/ Hight ketone use.
ne) €aty access to ole psiogsiams
| duhile ay languages provide — suppostt fox 0S functionality sesipling |
| vanguage —gentorathy pavide omezing ancl mutch move — fundamental
built in Support»
Gi) sophisheajed — paticrn matching ond thing moripulation,
i) igh weuel dato. types i
| = sesiipfing venquages pide support for’ seks, dicHonanies, Tut and |
| tuples (at ‘ reirimum) i
| & uses of _scoipfing languages >
Scotipling languages ane oh two Kinds ¢
| c-taaditonal sesipling
Gi) Modean — sesiipting
i) Taaditfona)_Sscotipting ¢
| athe achvities which sequiste traditional seatipting Anclude
[+ gysteen admint station
| + conboiting Remole arpiieaons
} + Sytem ond application txdensions.
i: apesiimen tal progorarnrnfing
| + command Ine ‘initsiface
@ scanned with OKEN ScannerG2) Madeain_scofipting &
+ visual seatipling
+ Scofiplable components
| + client-side & seamed side web seatipting .
| + Heb Scatipting ¢
| Pie Serfpt » a Computes paroysiamming language tos adding dynamic
| copavilities to wold wide web g pages
| ub scaipting can add ‘information 40 % page ar a seaden uses
‘A om tet the mendes enter infomation, that may be be pastecl
ty to the o3desn department of on Gnline business.
web Sexipting divides into shee anleag ¢
Gy paoceasing tasimé
Gd cneating pages with enhanced visual eects g uses ntesracHon,
Gi) Geneatating pager ‘on the Hy’ om maresiial held ina database.
| Ch) puocesting wel fosms s
> tn the ontginal Smplementatio ef the webs when the form is
i Submited — tos Processing the information. entered by the wer
|, tmeoded and gent to the fenvea fo papceasing ty a che
| seaipt that tuentuatty —geneaales on HTM fog Yo be sent back
|p the wth browitar.
i
. : |
1 Git) pynamic web pages § i
j
Boynamic WIMLy as Gmplemented in the tnitmet Explosie, makes |
|
faery tenponent tk a we page [headings 5 archosy tables, fom |
{
Components etc] a seriptable object - |
ois makes Tk possible 4o paovide wry elaborate dynamic Corto! |
wen the appearance a web page and 40 pride fmple |
interaction with the ares using — geatpts waitin ty gave spl] |
‘Dope ov VeKsipty which are fnkrpreted — by dhe _bmore
@ scanned with OKEN ScannerUW pgnavescany genenaded reat
another tosr of dayne vith page “ie one An which some os
all ey Ue MIME He genearated —seaiiplt Precuted an the denver | |
SA toomen applieation af the decheique Tato tonstauct pages hose |
tenknt is AGitued omy a database
(gt mice wils 1s woh saves mplemeals #0, cated active Seaveot
rays (asp) which ntersiporale — seaiiplt in steotpls es vpscorpt i
rahe urivese of seaapting donguages ¢
-> Sceipling Cn be traditional ov modeain staipting and web
sevipling Joma an mmpor ent peat of mnodesin siping
Scsipting univesue tentang mul Hple ovesilapping wosttds
sthe osfginat — untx wood of Aadl?Honal siphing using pe.
athe micsipsoft wontd of visual Basic and active tonbols
e qhe wotd of vRA {ov ststipting compound —clo(uments.
+ the world of dent -seswen aides web —sesfipting.
the evesttop 6 omplee, for Example web scaiipling can be done
TN VASsfipt y Tavascsipt | aucaript + peal or Tel
this urivestse hax been entarged as peal and tel ane used to
implement torapled —applicatfons us (ange organizations .
| qr ta hae been wed te develop a mafor banking gyskm,
i and pra} has been unc to Smglement an eniesmice ~ wide
document management syulem qr a teacting aerospace tornpoai,
| |
| |
@ scanned with OKEN ScannerPere
& Names and values ¢
| Pesil maripulttes vasabtes which hawe a name i
| A value ts assigned to stored in vashable by aasignment
} Malement of the jem + |
name , * Banana! = >8);
| pant ‘the pice ef one apple is $item catalog 1
| EX%Apple YY god tons Wn" 5 i
|| ¥ Stalan_eaprtscions
ii
I
i
| > Scala data iHems ote tombined info tps es sions uging opestatosts
peal has a~tet of operatosis
| san the following — deelions we destoiibe the available peat in
Ahein natural groupings ~ astithmetic y shings , logical ete.
0 Aatithmete opestatons ¢ i
| Pest provides the usual evthmelfc opestatos, Indud?ng autto~intsement |
| and autlo-decs-enent —opeatosis alte the manne» 6b C-
fet; $d=t4 $c; i
| pat-incmement - dhe sequence 4x Increment & shen aucign |
kez; gd Fete;
|
|
|
|
| post -ncsement - dhe sequence ie actlyn g then ‘increments |
| sino, athmelic —opesiations tan be tembined with assignment , i
Gqi Fatsa; (Mids at fa, seing equivalent to) |
pa fat3; |
|
|
|
j
|
|G ghagy_opesatons +
Gy plot moth oh The processing “done by asing halt = in
{ funcfons and augulas Rapsiedsions »
| pen uses pestod (tow toncatenation of shinge, |
Fs the dhea Hing — eppiaha fe (0 5 usec fo replicate hing. \
i fo. = *helto" x3 i
I $2 = “hatipheltohe lo” |
i foo = |
@ scanned with OKEN Scanner| > Anithme tte operatoas used in sting tonto.
J ESAo-Tnesement sg a vastlanle 41 assigned wt sling lies
i) & digits thea autly nexemenl — pptaalon 48 applied on the sting
fom nighlmost cheaiaclest-
{Gs fax sallsa';
} phat cepa;
sles £ mm a3,
4
is applied to shing which Masts with a
1 WI) unany mous: Gf Hy
| Pls ov minus. characte, then ib oelums the Jame sting with,
| oppose ign.
Gt fname = #52"
= fname = “fa |
G8) compaatson _opestatos :
\
La valuet of Competion 98 sitlymecl 7 numbeais. f
(SS TP tue, and on empty sting (*") ~1f tale, |
j chee xe classified Fnty 4p Kindt. one fot numbers and 0 thest |
| fo01 ahings.
| nlumbestst =o fe 9 2) 22 C2929 Cem (vompadiion operator)
|
100) Logical opeoiatost 2
j mot =!
| and 4
(W) conditional eapsestions 2
cork Ge dhe one whose value f chiten dom one of the allematives
Fat sunfime depending on the —euctiorne of fest
dest] Taue -enps false - fap |
eg: da = (aco)? : $a; i
os- i]
pant Yorint Th fa ci and gh cia; i
|
|
|
@ scanned with OKEN ScannerLongo) _shuctuses : 1
1A Conbol Shuclsie fs a Hock ef progatammfing that analyzes
Vertiabler and choses a distction in which to qe bLaseol en given
Pooamelesis.
asthe doin How cobol deteile the disiection a the proqsian 40hes.
Blocks GY G4 a sequerwe of one os mere Statemente enclosed in
tasty braces
ai i
$ positive = 45 |
dnagative ety |
3
“ coneifons + 4 candifon M4 a plat typo which te evalualed Tra |
Botlean tonbats ck TE Evaluates o zeso of she emply ating she :
ie due
tondifons usually make Use os Hlaffonal opestatosts- |
Cae Molal 750
€ total 7D and f fla ¢ oo |
| tendifon XC folse, othemwise VE |
| A tendifipn can be negated using (1) operates, we can specify that
as (hftolal emp and ftotal ¢ 1009.
Conditional _Epsestons ¢
| entant fupsesstons should be ty baratkets.
[AR dhen-elee Skalements 2 it (total >to)
Wee) Ww) : ype =n; |
int * total in! - j
Mbps elseit (4total > 0)
4 apts
‘ i eee Ms |
i
else ae
paint "oad total ant Agaabe ves |
: fbbtal <0; /
' 5 |
@ scanned with OKEN ScannerAtkeanafives feo if-then-else
To use a andifional taprrssion in place of a Tt -dheqeelie conshudl.
iE dace)
(gb =o) con be . -
ee cory eee
({b=))
Stakement qual
A Single saktnxat ceo be followed by @ tenditional modifier
@ PANE “oKANS
U fvoits > =0 A;
paint “weak \y"
oe SEEM and z-and eptaaty
quits 2 65;
this con be waien as:
pant (( trolls y=65) ) “okln'y UC frotte >= ba) Tweak (n'y);
| Repetiion :
| Repetition mechonism includes both Healing loops and Counting ops.
| Tea loops
bile:
white (Ga! = $b)
| * Ua 4b)
© far fa- fh;
j
| ase
€ foe fb-ta;
+?
LTE Geecules Fil the Condition Be false,
F tene “ual te ged to impave the ntadability .
ey go+-a until ta>gb;
. 7 =
|
i
@ scanned with OKEN Scanner| POAoops at is wath an fencer athe than a agtackic Consul.
War, the ondifion ie desled allen the fecution othe Hotky so
Abe Mock 16 fxeculed al- katt once.
do }
Ywhite gate ths
Counting loops : i
tos (i= 15 432105 ¢344)
{
Fiz squone= 47 %s7>
PHL EEL GT cquave ns
§
fesgach $101 +10) §
Si-squooie = git gi
$ pint "Hut $f_squareyn";
j i
¥ Arse ¢ i
he arsay is used to shre the (ot of valuer ond each object oh i
the isk fs domed ac an element.
Elements fan be numbesis of Shings.
| Syptet : @ormauytiamne = (element 4, glementa,---. 3
| Accessing anstay in pet ¢
PH access a Lingle element of a pert away, use (4) Gar belore
4} Variable name. we can aiSume that Sgn sepaesents singular
| value & © vgn sepiesents plana values,
| Swwtave naome uftt be Alowed by square twackets wlth index
| ‘inside Sk, we Con access on anray,
]
| Ayntaey © aviay Name = (“Apple 4 *mangoy);
Seompene ty > Vnilde square brackets
orrouname.
@ scanned with OKEN Scanner|? WE Con add of nemove an element fom an arta using some
ssi) functions.
| © mush or enay,
-funcKons
| DH helps to append a new element at the end af the array
© Mt Caray ("ping ,"2ed";
push @orray, "biue ty
i pant “@ assayan";
i op: pink sed blue
Oey en evrey:
| he Pop axstoy function siemmover the last Clement. fom he array.
Qe @ amay = [fnkt aed");
pop @avroy ;
Pint * Macsray \n"5
Ops pink
Ch) hittin aes 3
“Ft semoves Phe UehY most element ef an array & thus thor ten the
© array by A
| Cg @away = (pink, need);
i Shit Gamay;
I phot “@array\n";
iu unihith en array :
Gy Qaveray = (" pink” , Ssed") 5
whit @arrHy 1 “orange;
pink “@ away yy";
| oops eronge pink aecl
@ scanned with OKEN Scanner[A peal Mak Ge a sequen q sealae values+ we need fo Use path |
| aiedis & lomma. ppeaaior do anshucl a bls
| reach value mn the Mtr seated Gib element:
[28 elements axe indeeed ond erdened, |
we Con ateles fo ach elemend by TH position.
| Simple lids ¢
| UN} ~ empty aa
(10,20; 30) — Hist integeas
Canis Ma"sentsbey 5 — ab of stings |
PA peat st may tontdin elements that howe different dala types Ahic |
Kind mf RA Te cated a complex (st |
my $1105 |
my $8 = Aq dking;
print ("comple ti" BC $os"Nnrs |
Rattening tit +
Flactkentin Wists |
A Wisk inde oak, peal austorna Ficaty Alutens ahe Inlemal fst
Gg (314 (5,6)
(00 345, 6) AN ot same fists.
(C22, 409) |
ceasing fiat element + 1)
we on access fhe clemenk ef alist by wing the zero-based Index
so aecess she ath element, we need to putin-1) inden Anstde square’
{ baackels. '
{ Syntart sd ist Nome [inden J; ; i
| Booges: peat allows you fo wild a fit taved on a range of i
F tumbets ot chavacteat. 1
eos
@ scanned with OKEN Scanner| ¥ Hashes :
[the hashes ig the mol €tsenbol ond fal luenfol pont ef she peed
language . i
A hath 35 9 grup of key-value pasiis
otk Kegs axe urvique sings & values aye sealant values
Hashes axe declayed using my keyword,
|
|
she vaste name dase with alt) Sign. |
Hashes ate same like as aways , but hashes are unordeed and |
abo the hash elements ot actesced using is value while ovvay
elements ane accecced using iH inde value. |
>No Mepeating keys me allowed in hatches edhich makes the key
values unique ‘inside @ hash
Jyalares my" hashNome = ("Key =>" value") 5
A
| To access elements pf hash, (4) Sign is used before the yaaiable
Lname and then Key element is wstten inside fy tances
Sg my Te Capitals ~ (*Jadia = 5 mew ethi", ufuid" - p¥mango!) 5
pint “ deapital §* andiat dn";
Olt New oethi \
[sage
1 Dshings one on ewsenHial part ch the pes! language.
\ They ae Scalan vavIAbIes, go they Gast with (4) sign,
JA shing can be difined within a dingle quote (4) or double
quale (").
[3% petty fo declare a shing use “my neyeorrd tefore varianle amy,
l
ing :
PA Shing con be iniHalised and — declased within the Fetowing syntet:
i my $vosiiatte Nome = “4s
the opesatoss make easy ty maniputate ashing im different
4 ways.
@ scanned with OKEN Scanner| ese cee too types of Shing opesatoss + they one: () toncatenation(.) |
{ Gi) RepRhfion(x) |
(© tncatenaion open ¢
| Peal Shing ote — toncatenated ult « (+) Ban instead eb t+) Sign,
9. 4 fiat Name = “chisHan'S
Hast Name = 4 greutt
tun norne- $4es4Name * * test ame:
: 3
PAM " gsuiNamern" ; |
| Olp: drastHen Grey
eal stings fon be — epeakd a number of dimer with (Y) vara,
Qs Betts chants"?
i foutput = flertya; f
| PAnl ” foulpat inv; :
| Ops shanks thanks thanks j
| R paitesin and Regular Cupnessions ¢
jeliein
A patton ie a Sequence of character fo be sasched for ina |
i chonache sting.
(oh peal, pations Ake patn det axe nemaity enclosed tn slash
| dhetacten 2 / def /
| ahic sepaeseals the patlem at.
Tt the palm ig found, a match eccure
fg: Shing = sedefine — patkon= Ide]
[Hea the pater matches with the String at the third, fous th &
Sh chovactess.
swe hive pxton malthing in the Misay dunction spl
@arsayy= split Uy time)5
@ scanned with OKEN Scanner| Wee she paticsin (1) matcher a Jingle spacey which spfily 9 ttme
‘nto wosids.
> peAl defines apetial opestands that Jes whether & parWiGulat paticen
SPPCS I a chavactea hing . i
Gems ad dea whetest « patie is matched: |
HL aeautly a ron-zem0 value ov due if i is found 0, of false,
A the pater 3s not matched 1
EY orate = dale w fare! j i
Gi) Led ah checks whether 0 paiiegin $4 not matcheol i
qoesutt = tual tm fabel; |
Fe seus or GL ie dound \
41 mesuits @ non-zeto value, iL 3s nol found '
fegulan exprecsons : |
| AL srequtan —frprmasions Fe aq suferred Shing of chanaclew that defines
the pattein of pateins you este viewing
_. Sequlor tapsiuion is also referee to as PEEL ov te gPXp.
ja Sequlas —Eaprtition an be
i Ae jase you want ty match,
Syatert 2 shing sr segt 5 i
aitheor simple os Complet y depending on
te baste method dor applying a *egulan fupmticon Ws touse the |
pater binding —opestatoas = my and [w
| oae put opesratos
Wa ok and assignment opesator:
these ote thyee Negulaa Cipetition opesaters with tn peat,
match septa expression —m jp i
| aubstitute aaglles — Eoyreaston — gj
> Than cilebale Aegulas eaprestion ~t]) i
|
@ scanned with OKEN Scannera dubstoutines + |
SA yell funclon os cubnuline is @ goup Salements shad
together perform a pecitic tach, |
[the cod Jaksgufines used most tn pest prey.siamrning batons.
WS cxtated wing heepeord Suh.
Se Cay define the Junot in peal Gs as olloios 3
Sub Submuting «name
‘ A hody tf mvthed os subsnutine.
4
>TO Use this defined — Submuttne, we need fo call the Subsubines. In
peal subsoulines tan be autled by passing she arquenents fit fo
as fallowt ¢
Subswtin€ name (asjuments — fist) ;
Gg: sub area
gsid= $afo] 5
seu ($side * ¢uide);
f toto ova = area (4) 5
pint ¢totalanea;
| ooptie \
| vantages ‘ |
| oat helps us to mtue the lode ancl makes the provers af Brading,
P10 & debug easy. i
>it helps in org aniizing the fede 4 shuchrel fosmal-
51 fntetases she Code readability,
|
@ scanned with OKEN Scanner