home *** CD-ROM | disk | FTP | other *** search
/ Netscape Plug-Ins Developer's Kit / Netscape_Plug-Ins_Developers_Kit.iso / CGIPERL / MACPERL / MTOOL418.HQX / Mac_Perl_418_tool / PerlHelp < prev    next >
MacBinary  |  1994-11-16  |  227.5 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: PerlHelp

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Wed Nov 16 00:24:07 1994, modified Wed Nov 16 00:24:07 1994, creator 'MPS ', type ASCII, 232259 bytes "PerlHelp" , at 0x38bc3 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 50 65 72 6c 48 65 | 6c 70 00 00 00 00 00 00 |..PerlHe|lp......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 03 8b 43 00 | 00 01 ac aa ef 47 f7 aa |......C.|.....G..|
|00000060| ef 47 f7 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.G......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 2c 95 00 00 |........|....,...|
|00000080| be 4b 59 20 43 6f 70 79 | 72 69 67 68 74 4e 6f 74 |.KY Copy|rightNot|
|00000090| 69 63 65 0d be 43 0d 4c | 61 72 72 79 20 57 61 6c |ice..C.L|arry Wal|
|000000a0| 6c 20 3c 6c 77 61 6c 6c | 40 6e 65 74 6c 61 62 73 |l <lwall|@netlabs|
|000000b0| 2e 63 6f 6d 3e 0d 4d 61 | 63 69 6e 74 6f 73 68 20 |.com>.Ma|cintosh |
|000000c0| 70 6f 72 74 20 62 79 0d | 0d 20 20 20 4d 61 74 74 |port by.|. Matt|
|000000d0| 68 69 61 73 20 4e 65 65 | 72 61 63 68 65 72 20 3c |hias Nee|racher <|
|000000e0| 6e 65 65 72 69 40 69 69 | 73 2e 65 74 68 7a 2e 63 |neeri@ii|s.ethz.c|
|000000f0| 68 3e 0d 20 20 20 54 69 | 6d 20 45 6e 64 72 65 73 |h>. Ti|m Endres|
|00000100| 20 20 20 20 20 20 20 20 | 20 3c 74 69 6d 65 40 69 | | <time@i|
|00000110| 63 65 2e 63 6f 6d 3e 0d | 0d be 4b 59 20 48 65 6c |ce.com>.|..KY Hel|
|00000120| 70 0d 50 65 72 6c 48 65 | 6c 70 0d be 4b 4c 20 41 |p.PerlHe|lp..KL A|
|00000130| 62 6f 75 74 c9 50 65 72 | 6c 0d 50 65 72 6c c9 4f |bout.Per|l.Perl.O|
|00000140| 70 74 69 6f 6e 73 0d 50 | 65 72 6c c9 54 79 70 65 |ptions.P|erl.Type|
|00000150| 73 0d 50 65 72 6c c9 53 | 79 6e 74 61 78 0d 50 65 |s.Perl.S|yntax.Pe|
|00000160| 72 6c c9 43 6f 6d 70 6f | 75 6e 64 c9 53 74 61 74 |rl.Compo|und.Stat|
|00000170| 65 6d 65 6e 74 73 0d 50 | 65 72 6c c9 53 69 6d 70 |ements.P|erl.Simp|
|00000180| 6c 65 c9 53 74 61 74 65 | 6d 65 6e 74 73 0d 50 65 |le.State|ments.Pe|
|00000190| 72 6c c9 45 78 70 72 65 | 73 73 69 6f 6e 73 0d 50 |rl.Expre|ssions.P|
|000001a0| 65 72 6c c9 4f 70 65 72 | 61 74 6f 72 73 0d 50 65 |erl.Oper|ators.Pe|
|000001b0| 72 6c c9 50 72 65 63 65 | 64 65 6e 63 65 0d 50 65 |rl.Prece|dence.Pe|
|000001c0| 72 6c c9 53 75 62 72 6f | 75 74 69 6e 65 73 0d 50 |rl.Subro|utines.P|
|000001d0| 65 72 6c c9 52 65 67 65 | 78 70 0d 50 65 72 6c c9 |erl.Rege|xp.Perl.|
|000001e0| 46 6f 72 6d 61 74 73 0d | 50 65 72 6c c9 49 50 43 |Formats.|Perl.IPC|
|000001f0| 0d 50 65 72 6c c9 56 61 | 72 69 61 62 6c 65 73 0d |.Perl.Va|riables.|
|00000200| 50 65 72 6c c9 50 61 63 | 6b 61 67 65 73 0d 50 65 |Perl.Pac|kages.Pe|
|00000210| 72 6c c9 53 74 79 6c 65 | 0d 50 65 72 6c c9 44 65 |rl.Style|.Perl.De|
|00000220| 62 75 67 67 69 6e 67 0d | 50 65 72 6c c9 45 6e 76 |bugging.|Perl.Env|
|00000230| 69 72 6f 6e 6d 65 6e 74 | 0d 50 65 72 6c c9 44 69 |ironment|.Perl.Di|
|00000240| 61 67 6e 6f 73 74 69 63 | 73 0d 50 65 72 6c c9 54 |agnostic|s.Perl.T|
|00000250| 72 61 70 73 0d 50 65 72 | 6c c9 45 72 72 61 74 61 |raps.Per|l.Errata|
|00000260| 0d 50 65 72 6c c9 42 75 | 67 73 0d 50 65 72 6c c9 |.Perl.Bu|gs.Perl.|
|00000270| 4d 61 63 69 6e 74 6f 73 | 68 c9 45 78 74 65 6e 73 |Macintos|h.Extens|
|00000280| 69 6f 6e 73 0d 0d 61 63 | 63 65 70 74 0d 61 6c 61 |ions..ac|cept.ala|
|00000290| 72 6d 0d 61 74 61 6e 32 | 0d 62 69 6e 64 0d 62 69 |rm.atan2|.bind.bi|
|000002a0| 6e 6d 6f 64 65 0d 63 61 | 6c 6c 65 72 0d 63 68 64 |nmode.ca|ller.chd|
|000002b0| 69 72 0d 63 68 6d 6f 64 | 0d 63 68 6f 6f 73 65 0d |ir.chmod|.choose.|
|000002c0| 63 68 6f 70 0d 63 68 6f | 77 6e 0d 63 68 72 6f 6f |chop.cho|wn.chroo|
|000002d0| 74 0d 63 6c 6f 73 65 0d | 63 6c 6f 73 65 64 69 72 |t.close.|closedir|
|000002e0| 0d 63 6f 6e 6e 65 63 74 | 0d 63 6f 73 0d 63 72 79 |.connect|.cos.cry|
|000002f0| 70 74 0d 64 62 6d 63 6c | 6f 73 65 0d 64 62 6d 6f |pt.dbmcl|ose.dbmo|
|00000300| 70 65 6e 0d 64 65 66 69 | 6e 65 64 0d 64 65 6c 65 |pen.defi|ned.dele|
|00000310| 74 65 0d 64 69 65 0d 64 | 6f 0d 64 75 6d 70 0d 65 |te.die.d|o.dump.e|
|00000320| 61 63 68 0d 65 6e 64 68 | 6f 73 74 65 6e 74 0d 65 |ach.endh|ostent.e|
|00000330| 6e 64 70 72 6f 74 6f 65 | 6e 74 0d 65 6e 64 73 65 |ndprotoe|nt.endse|
|00000340| 72 76 65 6e 74 0d 65 6f | 66 0d 65 76 61 6c 0d 65 |rvent.eo|f.eval.e|
|00000350| 78 65 63 0d 65 78 69 74 | 0d 65 78 70 0d 66 63 6e |xec.exit|.exp.fcn|
|00000360| 74 6c 0d 66 69 6c 65 6e | 6f 0d 66 6c 6f 63 6b 0d |tl.filen|o.flock.|
|00000370| 66 6f 72 6b 0d 67 65 74 | 63 0d 67 65 74 68 6f 73 |fork.get|c.gethos|
|00000380| 74 62 79 61 64 64 72 0d | 67 65 74 68 6f 73 74 62 |tbyaddr.|gethostb|
|00000390| 79 6e 61 6d 65 0d 67 65 | 74 68 6f 73 74 65 6e 74 |yname.ge|thostent|
|000003a0| 0d 67 65 74 6c 6f 67 69 | 6e 0d 67 65 74 70 65 65 |.getlogi|n.getpee|
|000003b0| 72 6e 61 6d 65 0d 67 65 | 74 70 72 6f 74 6f 62 79 |rname.ge|tprotoby|
|000003c0| 6e 61 6d 65 0d 67 65 74 | 70 72 6f 74 6f 62 79 6e |name.get|protobyn|
|000003d0| 75 6d 62 65 72 0d 67 65 | 74 70 72 6f 74 6f 65 6e |umber.ge|tprotoen|
|000003e0| 74 0d 67 65 74 73 65 72 | 76 62 79 6e 61 6d 65 0d |t.getser|vbyname.|
|000003f0| 67 65 74 73 65 72 76 62 | 79 70 6f 72 74 0d 67 65 |getservb|yport.ge|
|00000400| 74 73 65 72 76 65 6e 74 | 0d 67 65 74 73 6f 63 6b |tservent|.getsock|
|00000410| 6e 61 6d 65 0d 67 65 74 | 73 6f 63 6b 6f 70 74 0d |name.get|sockopt.|
|00000420| 67 6d 74 69 6d 65 0d 67 | 6f 74 6f 0d 67 72 65 70 |gmtime.g|oto.grep|
|00000430| 0d 68 65 78 0d 69 6e 64 | 65 78 0d 69 6e 74 0d 69 |.hex.ind|ex.int.i|
|00000440| 6f 63 74 6c 0d 6a 6f 69 | 6e 0d 6b 65 79 73 0d 6b |octl.joi|n.keys.k|
|00000450| 69 6c 6c 0d 6c 61 73 74 | 0d 6c 65 6e 67 74 68 0d |ill.last|.length.|
|00000460| 6c 69 6e 6b 0d 6c 69 73 | 74 65 6e 0d 6c 6f 63 61 |link.lis|ten.loca|
|00000470| 6c 0d 6c 6f 63 61 6c 74 | 69 6d 65 0d 6c 6f 67 0d |l.localt|ime.log.|
|00000480| 6c 73 74 61 74 0d 6d 0d | 6d 6b 64 69 72 0d 6d 73 |lstat.m.|mkdir.ms|
|00000490| 67 63 74 6c 0d 6d 73 67 | 67 65 74 0d 6d 73 67 72 |gctl.msg|get.msgr|
|000004a0| 63 76 0d 6d 73 67 73 6e | 64 0d 6e 65 78 74 0d 6f |cv.msgsn|d.next.o|
|000004b0| 63 74 0d 6f 70 65 6e 0d | 6f 70 65 6e 64 69 72 0d |ct.open.|opendir.|
|000004c0| 6f 72 64 0d 70 61 63 6b | 0d 70 69 70 65 0d 70 6f |ord.pack|.pipe.po|
|000004d0| 70 0d 70 72 69 6e 74 0d | 70 72 69 6e 74 66 0d 70 |p.print.|printf.p|
|000004e0| 75 73 68 0d 71 0d 72 61 | 6e 64 0d 72 65 61 64 0d |ush.q.ra|nd.read.|
|000004f0| 72 65 61 64 64 69 72 0d | 72 65 61 64 6c 69 6e 6b |readdir.|readlink|
|00000500| 0d 72 65 63 76 0d 72 65 | 64 6f 0d 72 65 6e 61 6d |.recv.re|do.renam|
|00000510| 65 0d 72 65 71 75 69 72 | 65 0d 72 65 73 65 74 0d |e.requir|e.reset.|
|00000520| 72 65 74 75 72 6e 0d 72 | 65 76 65 72 73 65 0d 72 |return.r|everse.r|
|00000530| 65 77 69 6e 64 64 69 72 | 0d 72 69 6e 64 65 78 0d |ewinddir|.rindex.|
|00000540| 72 6d 64 69 72 0d 73 0d | 73 63 61 6c 61 72 0d 73 |rmdir.s.|scalar.s|
|00000550| 65 65 6b 0d 73 65 65 6b | 64 69 72 0d 73 65 6c 65 |eek.seek|dir.sele|
|00000560| 63 74 0d 73 65 6d 63 74 | 6c 0d 73 65 6d 67 65 74 |ct.semct|l.semget|
|00000570| 0d 73 65 6d 6f 70 0d 73 | 65 6e 64 0d 73 65 74 67 |.semop.s|end.setg|
|00000580| 72 65 6e 74 0d 73 65 74 | 68 6f 73 74 65 6e 74 0d |rent.set|hostent.|
|00000590| 73 65 74 6e 65 74 65 6e | 74 0d 73 65 74 70 67 72 |setneten|t.setpgr|
|000005a0| 70 0d 73 65 74 70 72 69 | 6f 72 69 74 79 0d 73 65 |p.setpri|ority.se|
|000005b0| 74 70 72 6f 74 6f 65 6e | 74 0d 73 65 74 70 77 65 |tprotoen|t.setpwe|
|000005c0| 6e 74 0d 73 65 74 73 65 | 72 76 65 6e 74 0d 73 65 |nt.setse|rvent.se|
|000005d0| 74 73 6f 63 6b 6f 70 74 | 0d 73 68 69 66 74 0d 73 |tsockopt|.shift.s|
|000005e0| 68 6d 63 74 6c 0d 73 68 | 6d 67 65 74 0d 73 68 6d |hmctl.sh|mget.shm|
|000005f0| 72 65 61 64 0d 73 68 75 | 74 64 6f 77 6e 0d 73 69 |read.shu|tdown.si|
|00000600| 6e 0d 73 6c 65 65 70 0d | 73 6f 63 6b 65 74 0d 73 |n.sleep.|socket.s|
|00000610| 6f 63 6b 65 74 70 61 69 | 72 0d 73 6f 72 74 0d 73 |ocketpai|r.sort.s|
|00000620| 70 6c 69 63 65 0d 73 70 | 6c 69 74 0d 73 70 72 69 |plice.sp|lit.spri|
|00000630| 6e 74 66 0d 73 71 72 74 | 0d 73 72 61 6e 64 0d 73 |ntf.sqrt|.srand.s|
|00000640| 74 61 74 0d 73 74 75 64 | 79 0d 73 75 62 73 74 72 |tat.stud|y.substr|
|00000650| 0d 73 79 6d 6c 69 6e 6b | 0d 73 79 73 63 61 6c 6c |.symlink|.syscall|
|00000660| 0d 73 79 73 72 65 61 64 | 0d 73 79 73 74 65 6d 0d |.sysread|.system.|
|00000670| 73 79 73 77 72 69 74 65 | 0d 74 65 6c 6c 0d 74 65 |syswrite|.tell.te|
|00000680| 6c 6c 64 69 72 0d 74 69 | 6d 65 0d 74 69 6d 65 73 |lldir.ti|me.times|
|00000690| 0d 74 72 0d 74 72 75 6e | 63 61 74 65 0d 75 6d 61 |.tr.trun|cate.uma|
|000006a0| 73 6b 0d 75 6e 64 65 66 | 0d 75 6e 6c 69 6e 6b 0d |sk.undef|.unlink.|
|000006b0| 75 6e 70 61 63 6b 0d 75 | 6e 73 68 69 66 74 0d 75 |unpack.u|nshift.u|
|000006c0| 74 69 6d 65 0d 76 61 6c | 75 65 73 0d 76 65 63 0d |time.val|ues.vec.|
|000006d0| 77 61 69 74 0d 77 61 69 | 74 70 69 64 0d 77 61 6e |wait.wai|tpid.wan|
|000006e0| 74 61 72 72 61 79 0d 77 | 61 72 6e 0d 77 72 69 74 |tarray.w|arn.writ|
|000006f0| 65 0d be 4b 59 20 4d 61 | 63 50 65 72 6c c9 48 65 |e..KY Ma|cPerl.He|
|00000700| 6c 70 0d be 43 0d 57 65 | 6c 63 6f 6d 65 20 74 6f |lp..C.We|lcome to|
|00000710| 20 4d 61 63 50 65 72 6c | 21 0d 0d 54 6f 20 75 73 | MacPerl|!..To us|
|00000720| 65 20 74 68 65 20 6f 6e | 6c 69 6e 65 20 68 65 6c |e the on|line hel|
|00000730| 70 2c 20 73 65 6c 65 63 | 74 20 61 20 77 6f 72 64 |p, selec|t a word|
|00000740| 20 69 6e 20 61 20 77 69 | 6e 64 6f 77 20 61 6e 64 | in a wi|ndow and|
|00000750| 20 73 65 6c 65 63 74 20 | 74 68 69 73 0d 48 65 6c | select |this.Hel|
|00000760| 70 20 63 6f 6d 6d 61 6e | 64 2e 20 46 6f 72 20 61 |p comman|d. For a|
|00000770| 6e 20 6f 76 65 72 76 69 | 65 77 20 6f 66 20 61 76 |n overvi|ew of av|
|00000780| 61 69 6c 61 62 6c 65 20 | 68 65 6c 70 20 74 6f 70 |ailable |help top|
|00000790| 69 63 73 2c 20 73 65 6c | 65 63 74 20 22 48 65 6c |ics, sel|ect "Hel|
|000007a0| 70 22 0d 61 6e 64 20 73 | 65 6c 65 63 74 20 74 68 |p".and s|elect th|
|000007b0| 65 20 48 65 6c 70 20 63 | 6f 6d 6d 61 6e 64 2e 0d |e Help c|ommand..|
|000007c0| be 4b 59 20 50 65 72 6c | 0d 41 62 6f 75 74 c9 50 |.KY Perl|.About.P|
|000007d0| 65 72 6c 0d be 43 0d 50 | 65 72 6c 20 2d 2d 20 50 |erl..C.P|erl -- P|
|000007e0| 72 61 63 74 69 63 61 6c | 20 45 78 74 72 61 63 74 |ractical| Extract|
|000007f0| 69 6f 6e 20 61 6e 64 20 | 52 65 70 6f 72 74 20 4c |ion and |Report L|
|00000800| 61 6e 67 75 61 67 65 0d | 0d 50 65 72 6c 20 69 73 |anguage.|.Perl is|
|00000810| 20 61 6e 20 69 6e 74 65 | 72 70 72 65 74 65 64 20 | an inte|rpreted |
|00000820| 6c 61 6e 67 75 61 67 65 | 20 6f 70 74 69 6d 69 7a |language| optimiz|
|00000830| 65 64 20 66 6f 72 20 73 | 63 61 6e 6e 69 6e 67 20 |ed for s|canning |
|00000840| 61 72 62 69 74 72 61 72 | 79 0d 74 65 78 74 20 66 |arbitrar|y.text f|
|00000850| 69 6c 65 73 2c 20 65 78 | 74 72 61 63 74 69 6e 67 |iles, ex|tracting|
|00000860| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 66 72 6f | informa|tion fro|
|00000870| 6d 20 74 68 6f 73 65 20 | 74 65 78 74 20 66 69 6c |m those |text fil|
|00000880| 65 73 2c 20 61 6e 64 0d | 70 72 69 6e 74 69 6e 67 |es, and.|printing|
|00000890| 20 72 65 70 6f 72 74 73 | 20 62 61 73 65 64 20 6f | reports| based o|
|000008a0| 6e 20 74 68 61 74 20 69 | 6e 66 6f 72 6d 61 74 69 |n that i|nformati|
|000008b0| 6f 6e 2e 20 49 74 27 73 | 20 61 6c 73 6f 20 61 20 |on. It's| also a |
|000008c0| 67 6f 6f 64 0d 6c 61 6e | 67 75 61 67 65 20 66 6f |good.lan|guage fo|
|000008d0| 72 20 6d 61 6e 79 20 73 | 79 73 74 65 6d 20 6d 61 |r many s|ystem ma|
|000008e0| 6e 61 67 65 6d 65 6e 74 | 20 74 61 73 6b 73 2e 20 |nagement| tasks. |
|000008f0| 54 68 65 20 6c 61 6e 67 | 75 61 67 65 20 69 73 20 |The lang|uage is |
|00000900| 69 6e 74 65 6e 64 65 64 | 0d 74 6f 20 62 65 20 70 |intended|.to be p|
|00000910| 72 61 63 74 69 63 61 6c | 20 28 65 61 73 79 20 74 |ractical| (easy t|
|00000920| 6f 20 75 73 65 2c 20 65 | 66 66 69 63 69 65 6e 74 |o use, e|fficient|
|00000930| 2c 20 63 6f 6d 70 6c 65 | 74 65 29 20 72 61 74 68 |, comple|te) rath|
|00000940| 65 72 20 74 68 61 6e 0d | 62 65 61 75 74 69 66 75 |er than.|beautifu|
|00000950| 6c 20 28 74 69 6e 79 2c | 20 65 6c 65 67 61 6e 74 |l (tiny,| elegant|
|00000960| 2c 20 6d 69 6e 69 6d 61 | 6c 29 2e 20 20 49 74 20 |, minima|l). It |
|00000970| 63 6f 6d 62 69 6e 65 73 | 20 28 69 6e 20 74 68 65 |combines| (in the|
|00000980| 20 61 75 74 68 6f 72 27 | 73 0d 6f 70 69 6e 69 6f | author'|s.opinio|
|00000990| 6e 2c 20 61 6e 79 77 61 | 79 29 20 73 6f 6d 65 20 |n, anywa|y) some |
|000009a0| 6f 66 20 74 68 65 20 62 | 65 73 74 20 66 65 61 74 |of the b|est feat|
|000009b0| 75 72 65 73 20 6f 66 20 | 43 2c 20 73 65 64 2c 20 |ures of |C, sed, |
|000009c0| 61 77 6b 2c 20 61 6e 64 | 20 73 68 2c 0d 73 6f 20 |awk, and| sh,.so |
|000009d0| 70 65 6f 70 6c 65 20 66 | 61 6d 69 6c 69 61 72 20 |people f|amiliar |
|000009e0| 77 69 74 68 20 74 68 6f | 73 65 20 6c 61 6e 67 75 |with tho|se langu|
|000009f0| 61 67 65 73 20 73 68 6f | 75 6c 64 20 68 61 76 65 |ages sho|uld have|
|00000a00| 20 6c 69 74 74 6c 65 0d | 64 69 66 66 69 63 75 6c | little.|difficul|
|00000a10| 74 79 20 77 69 74 68 20 | 69 74 2e 20 20 28 4c 61 |ty with |it. (La|
|00000a20| 6e 67 75 61 67 65 20 68 | 69 73 74 6f 72 69 61 6e |nguage h|istorian|
|00000a30| 73 20 77 69 6c 6c 20 61 | 6c 73 6f 20 6e 6f 74 65 |s will a|lso note|
|00000a40| 20 73 6f 6d 65 0d 76 65 | 73 74 69 67 65 73 20 6f | some.ve|stiges o|
|00000a50| 66 20 63 73 68 2c 20 50 | 61 73 63 61 6c 2c 20 61 |f csh, P|ascal, a|
|00000a60| 6e 64 20 65 76 65 6e 20 | 42 41 53 49 43 2d 50 4c |nd even |BASIC-PL|
|00000a70| 55 53 2e 29 20 45 78 70 | 72 65 73 73 69 6f 6e 20 |US.) Exp|ression |
|00000a80| 73 79 6e 74 61 78 0d 63 | 6f 72 72 65 73 70 6f 6e |syntax.c|orrespon|
|00000a90| 64 73 20 71 75 69 74 65 | 20 63 6c 6f 73 65 6c 79 |ds quite| closely|
|00000aa0| 20 74 6f 20 43 20 65 78 | 70 72 65 73 73 69 6f 6e | to C ex|pression|
|00000ab0| 20 73 79 6e 74 61 78 2e | 20 55 6e 6c 69 6b 65 20 | syntax.| Unlike |
|00000ac0| 6d 6f 73 74 20 55 6e 69 | 78 0d 75 74 69 6c 69 74 |most Uni|x.utilit|
|00000ad0| 69 65 73 2c 20 70 65 72 | 6c 20 64 6f 65 73 20 6e |ies, per|l does n|
|00000ae0| 6f 74 20 61 72 62 69 74 | 72 61 72 69 6c 79 20 6c |ot arbit|rarily l|
|00000af0| 69 6d 69 74 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |imit the| size of|
|00000b00| 20 79 6f 75 72 20 64 61 | 74 61 2d 2d 69 66 0d 79 | your da|ta--if.y|
|00000b10| 6f 75 27 76 65 20 67 6f | 74 20 74 68 65 20 6d 65 |ou've go|t the me|
|00000b20| 6d 6f 72 79 2c 20 70 65 | 72 6c 20 63 61 6e 20 73 |mory, pe|rl can s|
|00000b30| 6c 75 72 70 20 69 6e 20 | 79 6f 75 72 20 77 68 6f |lurp in |your who|
|00000b40| 6c 65 20 66 69 6c 65 20 | 61 73 20 61 20 73 69 6e |le file |as a sin|
|00000b50| 67 6c 65 0d 73 74 72 69 | 6e 67 2e 20 52 65 63 75 |gle.stri|ng. Recu|
|00000b60| 72 73 69 6f 6e 20 69 73 | 20 6f 66 20 75 6e 6c 69 |rsion is| of unli|
|00000b70| 6d 69 74 65 64 20 64 65 | 70 74 68 2e 20 20 41 6e |mited de|pth. An|
|00000b80| 64 20 74 68 65 20 68 61 | 73 68 20 74 61 62 6c 65 |d the ha|sh table|
|00000b90| 73 20 75 73 65 64 20 62 | 79 0d 61 73 73 6f 63 69 |s used b|y.associ|
|00000ba0| 61 74 69 76 65 20 61 72 | 72 61 79 73 20 67 72 6f |ative ar|rays gro|
|00000bb0| 77 20 61 73 20 6e 65 63 | 65 73 73 61 72 79 20 74 |w as nec|essary t|
|00000bc0| 6f 20 70 72 65 76 65 6e | 74 20 64 65 67 72 61 64 |o preven|t degrad|
|00000bd0| 65 64 20 70 65 72 66 6f | 72 6d 61 6e 63 65 2e 0d |ed perfo|rmance..|
|00000be0| 50 65 72 6c 20 75 73 65 | 73 20 73 6f 70 68 69 73 |Perl use|s sophis|
|00000bf0| 74 69 2d 20 63 61 74 65 | 64 20 70 61 74 74 65 72 |ti- cate|d patter|
|00000c00| 6e 20 6d 61 74 63 68 69 | 6e 67 20 74 65 63 68 6e |n matchi|ng techn|
|00000c10| 69 71 75 65 73 20 74 6f | 20 73 63 61 6e 20 6c 61 |iques to| scan la|
|00000c20| 72 67 65 0d 61 6d 6f 75 | 6e 74 73 20 6f 66 20 64 |rge.amou|nts of d|
|00000c30| 61 74 61 20 76 65 72 79 | 20 71 75 69 63 6b 6c 79 |ata very| quickly|
|00000c40| 2e 20 41 6c 74 68 6f 75 | 67 68 20 6f 70 74 69 6d |. Althou|gh optim|
|00000c50| 69 7a 65 64 20 66 6f 72 | 20 73 63 61 6e 6e 69 6e |ized for| scannin|
|00000c60| 67 20 74 65 78 74 2c 0d | 70 65 72 6c 20 63 61 6e |g text,.|perl can|
|00000c70| 20 61 6c 73 6f 20 64 65 | 61 6c 20 77 69 74 68 20 | also de|al with |
|00000c80| 62 69 6e 61 72 79 20 64 | 61 74 61 2c 20 61 6e 64 |binary d|ata, and|
|00000c90| 20 63 61 6e 20 6d 61 6b | 65 20 64 62 6d 20 66 69 | can mak|e dbm fi|
|00000ca0| 6c 65 73 20 6c 6f 6f 6b | 20 6c 69 6b 65 0d 61 73 |les look| like.as|
|00000cb0| 73 6f 63 69 61 74 69 76 | 65 20 61 72 72 61 79 73 |sociativ|e arrays|
|00000cc0| 20 28 77 68 65 72 65 20 | 64 62 6d 20 69 73 20 61 | (where |dbm is a|
|00000cd0| 76 61 69 6c 61 62 6c 65 | 29 2e 20 53 65 74 75 69 |vailable|). Setui|
|00000ce0| 64 20 70 65 72 6c 20 73 | 63 72 69 70 74 73 20 61 |d perl s|cripts a|
|00000cf0| 72 65 0d 73 61 66 65 72 | 20 74 68 61 6e 20 43 20 |re.safer| than C |
|00000d00| 70 72 6f 67 72 61 6d 73 | 20 74 68 72 6f 75 67 68 |programs| through|
|00000d10| 20 61 20 64 61 74 61 66 | 6c 6f 77 20 74 72 61 63 | a dataf|low trac|
|00000d20| 69 6e 67 20 6d 65 63 68 | 61 6e 69 73 6d 20 77 68 |ing mech|anism wh|
|00000d30| 69 63 68 0d 70 72 65 76 | 65 6e 74 73 20 6d 61 6e |ich.prev|ents man|
|00000d40| 79 20 73 74 75 70 69 64 | 20 73 65 63 75 72 69 74 |y stupid| securit|
|00000d50| 79 20 68 6f 6c 65 73 2e | 20 20 49 66 20 79 6f 75 |y holes.| If you|
|00000d60| 20 68 61 76 65 20 61 20 | 70 72 6f 62 6c 65 6d 20 | have a |problem |
|00000d70| 74 68 61 74 0d 77 6f 75 | 6c 64 20 6f 72 64 69 6e |that.wou|ld ordin|
|00000d80| 61 72 69 6c 79 20 75 73 | 65 20 73 65 64 20 6f 72 |arily us|e sed or|
|00000d90| 20 61 77 6b 20 6f 72 20 | 73 68 2c 20 62 75 74 20 | awk or |sh, but |
|00000da0| 69 74 20 65 78 63 65 65 | 64 73 20 74 68 65 69 72 |it excee|ds their|
|00000db0| 0d 63 61 70 61 62 69 6c | 69 74 69 65 73 20 6f 72 |.capabil|ities or|
|00000dc0| 20 6d 75 73 74 20 72 75 | 6e 20 61 20 6c 69 74 74 | must ru|n a litt|
|00000dd0| 6c 65 20 66 61 73 74 65 | 72 2c 20 61 6e 64 20 79 |le faste|r, and y|
|00000de0| 6f 75 20 64 6f 6e 27 74 | 20 77 61 6e 74 20 74 6f |ou don't| want to|
|00000df0| 20 77 72 69 74 65 0d 74 | 68 65 20 73 69 6c 6c 79 | write.t|he silly|
|00000e00| 20 74 68 69 6e 67 20 69 | 6e 20 43 2c 20 74 68 65 | thing i|n C, the|
|00000e10| 6e 20 70 65 72 6c 20 6d | 61 79 20 62 65 20 66 6f |n perl m|ay be fo|
|00000e20| 72 20 79 6f 75 2e 20 20 | 54 68 65 72 65 20 61 72 |r you. |There ar|
|00000e30| 65 20 61 6c 73 6f 0d 74 | 72 61 6e 73 6c 61 74 6f |e also.t|ranslato|
|00000e40| 72 73 20 74 6f 20 74 75 | 72 6e 20 79 6f 75 72 20 |rs to tu|rn your |
|00000e50| 73 65 64 20 61 6e 64 20 | 61 77 6b 20 73 63 72 69 |sed and |awk scri|
|00000e60| 70 74 73 20 69 6e 74 6f | 20 70 65 72 6c 20 73 63 |pts into| perl sc|
|00000e70| 72 69 70 74 73 2e 0d 4f | 4b 2c 20 65 6e 6f 75 67 |ripts..O|K, enoug|
|00000e80| 68 20 68 79 70 65 2e 0d | 0d 55 70 6f 6e 20 73 74 |h hype..|.Upon st|
|00000e90| 61 72 74 75 70 2c 20 70 | 65 72 6c 20 6c 6f 6f 6b |artup, p|erl look|
|00000ea0| 73 20 66 6f 72 20 79 6f | 75 72 20 73 63 72 69 70 |s for yo|ur scrip|
|00000eb0| 74 20 69 6e 20 6f 6e 65 | 20 6f 66 20 74 68 65 20 |t in one| of the |
|00000ec0| 66 6f 6c 6c 6f 77 69 6e | 67 0d 70 6c 61 63 65 73 |followin|g.places|
|00000ed0| 3a 0d 0d 31 2e 20 20 53 | 70 65 63 69 66 69 65 64 |:..1. S|pecified|
|00000ee0| 20 6c 69 6e 65 20 62 79 | 20 6c 69 6e 65 20 76 69 | line by| line vi|
|00000ef0| 61 20 2d 65 20 73 77 69 | 74 63 68 65 73 20 6f 6e |a -e swi|tches on|
|00000f00| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 20 6c 69 6e | the com|mand lin|
|00000f10| 65 2e 0d 0d 32 2e 20 20 | 43 6f 6e 74 61 69 6e 65 |e...2. |Containe|
|00000f20| 64 20 69 6e 20 74 68 65 | 20 66 69 6c 65 20 73 70 |d in the| file sp|
|00000f30| 65 63 69 66 69 65 64 20 | 62 79 20 74 68 65 20 66 |ecified |by the f|
|00000f40| 69 72 73 74 20 66 69 6c | 65 6e 61 6d 65 20 6f 6e |irst fil|ename on|
|00000f50| 20 74 68 65 0d 20 20 20 | 20 63 6f 6d 6d 61 6e 64 | the. | command|
|00000f60| 20 6c 69 6e 65 2e 20 20 | 28 4e 6f 74 65 20 74 68 | line. |(Note th|
|00000f70| 61 74 20 73 79 73 74 65 | 6d 73 20 73 75 70 70 6f |at syste|ms suppo|
|00000f80| 72 74 69 6e 67 20 74 68 | 65 20 23 21 20 6e 6f 74 |rting th|e #! not|
|00000f90| 61 74 69 6f 6e 0d 20 20 | 20 20 69 6e 76 6f 6b 65 |ation. | invoke|
|00000fa0| 20 69 6e 74 65 72 70 72 | 65 74 65 72 73 20 74 68 | interpr|eters th|
|00000fb0| 69 73 20 77 61 79 2e 29 | 0d 0d 33 2e 20 20 50 61 |is way.)|..3. Pa|
|00000fc0| 73 73 65 64 20 69 6e 20 | 69 6d 70 6c 69 63 69 74 |ssed in |implicit|
|00000fd0| 6c 79 20 76 69 61 20 73 | 74 61 6e 64 61 72 64 20 |ly via s|tandard |
|00000fe0| 69 6e 70 75 74 2e 20 20 | 54 68 69 73 20 6f 6e 6c |input. |This onl|
|00000ff0| 79 20 77 6f 72 6b 73 20 | 69 66 0d 20 20 20 20 74 |y works |if. t|
|00001000| 68 65 72 65 20 61 72 65 | 20 6e 6f 20 66 69 6c 65 |here are| no file|
|00001010| 6e 61 6d 65 20 61 72 67 | 75 6d 65 6e 74 73 2d 2d |name arg|uments--|
|00001020| 74 6f 20 70 61 73 73 20 | 61 72 67 75 6d 65 6e 74 |to pass |argument|
|00001030| 73 20 74 6f 20 61 20 73 | 74 64 69 6e 0d 20 20 20 |s to a s|tdin. |
|00001040| 20 73 63 72 69 70 74 20 | 79 6f 75 20 6d 75 73 74 | script |you must|
|00001050| 20 65 78 70 6c 69 63 69 | 74 6c 79 20 73 70 65 63 | explici|tly spec|
|00001060| 69 66 79 20 61 20 2d 20 | 66 6f 72 20 74 68 65 20 |ify a - |for the |
|00001070| 73 63 72 69 70 74 20 6e | 61 6d 65 2e 0d 0d 41 66 |script n|ame...Af|
|00001080| 74 65 72 20 6c 6f 63 61 | 74 69 6e 67 20 79 6f 75 |ter loca|ting you|
|00001090| 72 20 73 63 72 69 70 74 | 2c 20 70 65 72 6c 20 63 |r script|, perl c|
|000010a0| 6f 6d 70 69 6c 65 73 20 | 69 74 20 74 6f 20 61 6e |ompiles |it to an|
|000010b0| 20 69 6e 74 65 72 6e 61 | 6c 20 66 6f 72 6d 2e 0d | interna|l form..|
|000010c0| 49 66 20 74 68 65 20 73 | 63 72 69 70 74 20 69 73 |If the s|cript is|
|000010d0| 20 73 79 6e 74 61 63 74 | 69 63 61 6c 6c 79 20 63 | syntact|ically c|
|000010e0| 6f 72 72 65 63 74 2c 20 | 69 74 20 69 73 20 65 78 |orrect, |it is ex|
|000010f0| 65 63 75 74 65 64 2e 0d | 0d be 4b 59 20 50 65 72 |ecuted..|..KY Per|
|00001100| 6c c9 4f 70 74 69 6f 6e | 73 0d be 43 0d 41 20 73 |l.Option|s..C.A s|
|00001110| 69 6e 67 6c 65 2d 63 68 | 61 72 61 63 74 65 72 20 |ingle-ch|aracter |
|00001120| 6f 70 74 69 6f 6e 20 6d | 61 79 20 62 65 20 63 6f |option m|ay be co|
|00001130| 6d 62 69 6e 65 64 20 77 | 69 74 68 20 74 68 65 20 |mbined w|ith the |
|00001140| 66 6f 6c 6c 6f 77 69 6e | 67 0d 6f 70 74 69 6f 6e |followin|g.option|
|00001150| 2c 20 69 66 20 61 6e 79 | 2e 20 20 54 68 69 73 20 |, if any|. This |
|00001160| 69 73 20 70 61 72 74 69 | 63 75 6c 61 72 6c 79 20 |is parti|cularly |
|00001170| 75 73 65 66 75 6c 20 77 | 68 65 6e 20 69 6e 76 6f |useful w|hen invo|
|00001180| 6b 69 6e 67 20 61 0d 73 | 63 72 69 70 74 20 75 73 |king a.s|cript us|
|00001190| 69 6e 67 20 74 68 65 20 | 23 21 20 63 6f 6e 73 74 |ing the |#! const|
|000011a0| 72 75 63 74 20 77 68 69 | 63 68 20 6f 6e 6c 79 20 |ruct whi|ch only |
|000011b0| 61 6c 6c 6f 77 73 20 6f | 6e 65 20 61 72 67 75 6d |allows o|ne argum|
|000011c0| 65 6e 74 2e 0d 45 78 61 | 6d 70 6c 65 3a 0d 0d 20 |ent..Exa|mple:.. |
|000011d0| 20 20 20 20 23 21 2f 75 | 73 72 2f 62 69 6e 2f 70 | #!/u|sr/bin/p|
|000011e0| 65 72 6c 20 2d 73 70 69 | 2e 62 61 6b 20 23 20 73 |erl -spi|.bak # s|
|000011f0| 61 6d 65 20 61 73 20 2d | 73 20 2d 70 20 2d 69 2e |ame as -|s -p -i.|
|00001200| 62 61 6b 0d 20 20 20 20 | 20 2e 2e 2e 0d 0d 4f 70 |bak. | .....Op|
|00001210| 74 69 6f 6e 73 20 69 6e | 63 6c 75 64 65 3a 0d 0d |tions in|clude:..|
|00001220| 2d 30 64 69 67 69 74 73 | 0d 20 20 20 20 20 73 70 |-0digits|. sp|
|00001230| 65 63 69 66 69 65 73 20 | 74 68 65 20 72 65 63 6f |ecifies |the reco|
|00001240| 72 64 20 73 65 70 61 72 | 61 74 6f 72 20 28 24 2f |rd separ|ator ($/|
|00001250| 29 20 61 73 20 61 6e 20 | 6f 63 74 61 6c 20 6e 75 |) as an |octal nu|
|00001260| 6d 62 65 72 2e 20 20 49 | 66 0d 20 20 20 20 20 74 |mber. I|f. t|
|00001270| 68 65 72 65 20 61 72 65 | 20 6e 6f 20 64 69 67 69 |here are| no digi|
|00001280| 74 73 2c 20 74 68 65 20 | 6e 75 6c 6c 20 63 68 61 |ts, the |null cha|
|00001290| 72 61 63 74 65 72 20 69 | 73 20 74 68 65 20 73 65 |racter i|s the se|
|000012a0| 70 61 72 61 74 6f 72 2e | 0d 20 20 20 20 20 4f 74 |parator.|. Ot|
|000012b0| 68 65 72 20 73 77 69 74 | 63 68 65 73 20 6d 61 79 |her swit|ches may|
|000012c0| 20 70 72 65 63 65 64 65 | 20 6f 72 20 66 6f 6c 6c | precede| or foll|
|000012d0| 6f 77 20 74 68 65 20 64 | 69 67 69 74 73 2e 20 20 |ow the d|igits. |
|000012e0| 46 6f 72 20 65 78 61 6d | 2d 0d 20 20 20 20 20 70 |For exam|-. p|
|000012f0| 6c 65 2c 20 69 66 20 79 | 6f 75 20 68 61 76 65 20 |le, if y|ou have |
|00001300| 61 20 76 65 72 73 69 6f | 6e 20 6f 66 20 66 69 6e |a versio|n of fin|
|00001310| 64 20 77 68 69 63 68 20 | 63 61 6e 20 70 72 69 6e |d which |can prin|
|00001320| 74 20 66 69 6c 65 6e 61 | 6d 65 73 0d 20 20 20 20 |t filena|mes. |
|00001330| 20 74 65 72 6d 69 6e 61 | 74 65 64 20 62 79 20 74 | termina|ted by t|
|00001340| 68 65 20 6e 75 6c 6c 20 | 63 68 61 72 61 63 74 65 |he null |characte|
|00001350| 72 2c 20 79 6f 75 20 63 | 61 6e 20 73 61 79 20 74 |r, you c|an say t|
|00001360| 68 69 73 3a 0d 0d 20 20 | 20 20 20 20 20 20 20 20 |his:.. | |
|00001370| 20 20 20 20 20 66 69 6e | 64 20 2e 20 2d 6e 61 6d | fin|d . -nam|
|00001380| 65 20 27 2a 2e 62 61 6b | 27 20 2d 70 72 69 6e 74 |e '*.bak|' -print|
|00001390| 30 20 7c 20 70 65 72 6c | 20 2d 6e 30 65 20 75 6e |0 | perl| -n0e un|
|000013a0| 6c 69 6e 6b 0d 0d 20 20 | 20 20 20 54 68 65 20 73 |link.. | The s|
|000013b0| 70 65 63 69 61 6c 20 76 | 61 6c 75 65 20 30 30 20 |pecial v|alue 00 |
|000013c0| 77 69 6c 6c 20 63 61 75 | 73 65 20 50 65 72 6c 20 |will cau|se Perl |
|000013d0| 74 6f 20 73 6c 75 72 70 | 20 66 69 6c 65 73 20 69 |to slurp| files i|
|000013e0| 6e 20 70 61 72 61 2d 0d | 20 20 20 20 20 67 72 61 |n para-.| gra|
|000013f0| 70 68 20 6d 6f 64 65 2e | 20 20 54 68 65 20 76 61 |ph mode.| The va|
|00001400| 6c 75 65 20 30 37 37 37 | 20 77 69 6c 6c 20 63 61 |lue 0777| will ca|
|00001410| 75 73 65 20 50 65 72 6c | 20 74 6f 20 73 6c 75 72 |use Perl| to slur|
|00001420| 70 20 66 69 6c 65 73 0d | 20 20 20 20 20 77 68 6f |p files.| who|
|00001430| 6c 65 20 73 69 6e 63 65 | 20 74 68 65 72 65 20 69 |le since| there i|
|00001440| 73 20 6e 6f 20 6c 65 67 | 61 6c 20 63 68 61 72 61 |s no leg|al chara|
|00001450| 63 74 65 72 20 77 69 74 | 68 20 74 68 61 74 20 76 |cter wit|h that v|
|00001460| 61 6c 75 65 2e 0d 0d 2d | 61 20 20 20 74 75 72 6e |alue...-|a turn|
|00001470| 73 20 6f 6e 20 61 75 74 | 6f 73 70 6c 69 74 20 6d |s on aut|osplit m|
|00001480| 6f 64 65 20 77 68 65 6e | 20 75 73 65 64 20 77 69 |ode when| used wi|
|00001490| 74 68 20 61 20 2d 6e 20 | 6f 72 20 2d 70 2e 20 20 |th a -n |or -p. |
|000014a0| 41 6e 0d 20 20 20 20 20 | 69 6d 70 6c 69 63 69 74 |An. |implicit|
|000014b0| 20 73 70 6c 69 74 20 63 | 6f 6d 6d 61 6e 64 20 74 | split c|ommand t|
|000014c0| 6f 20 74 68 65 20 40 46 | 20 61 72 72 61 79 20 69 |o the @F| array i|
|000014d0| 73 20 64 6f 6e 65 20 61 | 73 20 74 68 65 20 66 69 |s done a|s the fi|
|000014e0| 72 73 74 0d 20 20 20 20 | 20 74 68 69 6e 67 20 69 |rst. | thing i|
|000014f0| 6e 73 69 64 65 20 74 68 | 65 20 69 6d 70 6c 69 63 |nside th|e implic|
|00001500| 69 74 20 77 68 69 6c 65 | 20 6c 6f 6f 70 20 70 72 |it while| loop pr|
|00001510| 6f 64 75 63 65 64 20 62 | 79 20 74 68 65 20 2d 6e |oduced b|y the -n|
|00001520| 20 6f 72 20 2d 70 2e 0d | 0d 20 20 20 20 20 20 20 | or -p..|. |
|00001530| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 70 65 72 | | per|
|00001540| 6c 20 2d 61 6e 65 20 27 | 70 72 69 6e 74 20 70 6f |l -ane '|print po|
|00001550| 70 28 40 46 29 2c 20 22 | 5c 6e 22 3b 27 0d 0d 20 |p(@F), "|\n";'.. |
|00001560| 20 20 20 20 69 73 20 65 | 71 75 69 76 61 6c 65 6e | is e|quivalen|
|00001570| 74 20 74 6f 0d 0d 20 20 | 20 20 20 20 20 20 20 20 |t to.. | |
|00001580| 20 20 20 20 20 20 20 20 | 20 20 77 68 69 6c 65 20 | | while |
|00001590| 28 3c 3e 29 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |(<>) {. | |
|000015a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000015b0| 40 46 20 3d 20 73 70 6c | 69 74 28 27 20 27 29 3b |@F = spl|it(' ');|
|000015c0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000015d0| 20 20 20 20 20 20 20 20 | 20 20 70 72 69 6e 74 20 | | print |
|000015e0| 70 6f 70 28 40 46 29 2c | 20 22 5c 6e 22 3b 0d 20 |pop(@F),| "\n";. |
|000015f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001600| 20 20 20 7d 0d 0d 0d 2d | 63 20 20 20 63 61 75 73 | }...-|c caus|
|00001610| 65 73 20 70 65 72 6c 20 | 74 6f 20 63 68 65 63 6b |es perl |to check|
|00001620| 20 74 68 65 20 73 79 6e | 74 61 78 20 6f 66 20 74 | the syn|tax of t|
|00001630| 68 65 20 73 63 72 69 70 | 74 20 61 6e 64 20 74 68 |he scrip|t and th|
|00001640| 65 6e 20 65 78 69 74 0d | 20 20 20 20 20 77 69 74 |en exit.| wit|
|00001650| 68 6f 75 74 20 65 78 65 | 63 75 74 69 6e 67 20 69 |hout exe|cuting i|
|00001660| 74 2e 0d 0d 2d 64 20 20 | 20 72 75 6e 73 20 74 68 |t...-d | runs th|
|00001670| 65 20 73 63 72 69 70 74 | 20 75 6e 64 65 72 20 74 |e script| under t|
|00001680| 68 65 20 70 65 72 6c 20 | 64 65 62 75 67 67 65 72 |he perl |debugger|
|00001690| 2e 20 20 53 65 65 20 74 | 68 65 20 73 65 63 74 69 |. See t|he secti|
|000016a0| 6f 6e 20 6f 6e 0d 20 20 | 20 20 20 44 65 62 75 67 |on on. | Debug|
|000016b0| 67 69 6e 67 2e 0d 0d 2d | 44 6e 75 6d 62 65 72 0d |ging...-|Dnumber.|
|000016c0| 20 20 20 20 20 73 65 74 | 73 20 64 65 62 75 67 67 | set|s debugg|
|000016d0| 69 6e 67 20 66 6c 61 67 | 73 2e 20 20 54 6f 20 77 |ing flag|s. To w|
|000016e0| 61 74 63 68 20 68 6f 77 | 20 69 74 20 65 78 65 63 |atch how| it exec|
|000016f0| 75 74 65 73 20 79 6f 75 | 72 20 73 63 72 69 70 74 |utes you|r script|
|00001700| 2c 0d 20 20 20 20 20 75 | 73 65 20 2d 44 31 34 2e |,. u|se -D14.|
|00001710| 20 20 28 54 68 69 73 20 | 6f 6e 6c 79 20 77 6f 72 | (This |only wor|
|00001720| 6b 73 20 69 66 20 64 65 | 62 75 67 67 69 6e 67 20 |ks if de|bugging |
|00001730| 69 73 20 63 6f 6d 70 69 | 6c 65 64 20 69 6e 74 6f |is compi|led into|
|00001740| 0d 20 20 20 20 20 79 6f | 75 72 20 70 65 72 6c 2e |. yo|ur perl.|
|00001750| 29 20 41 6e 6f 74 68 65 | 72 20 6e 69 63 65 20 76 |) Anothe|r nice v|
|00001760| 61 6c 75 65 20 69 73 20 | 2d 44 31 30 32 34 2c 20 |alue is |-D1024, |
|00001770| 77 68 69 63 68 20 6c 69 | 73 74 73 20 79 6f 75 72 |which li|sts your|
|00001780| 0d 20 20 20 20 20 63 6f | 6d 70 69 6c 65 64 20 73 |. co|mpiled s|
|00001790| 79 6e 74 61 78 20 74 72 | 65 65 2e 20 20 41 6e 64 |yntax tr|ee. And|
|000017a0| 20 2d 44 35 31 32 20 64 | 69 73 70 6c 61 79 73 20 | -D512 d|isplays |
|000017b0| 63 6f 6d 70 69 6c 65 64 | 20 72 65 67 75 6c 61 72 |compiled| regular|
|000017c0| 0d 20 20 20 20 20 65 78 | 70 72 65 73 73 69 6f 6e |. ex|pression|
|000017d0| 73 2e 0d 0d 2d 65 20 63 | 6f 6d 6d 61 6e 64 6c 69 |s...-e c|ommandli|
|000017e0| 6e 65 0d 20 20 20 20 20 | 6d 61 79 20 62 65 20 75 |ne. |may be u|
|000017f0| 73 65 64 20 74 6f 20 65 | 6e 74 65 72 20 6f 6e 65 |sed to e|nter one|
|00001800| 20 6c 69 6e 65 20 6f 66 | 20 73 63 72 69 70 74 2e | line of| script.|
|00001810| 20 20 4d 75 6c 74 69 70 | 6c 65 20 2d 65 20 63 6f | Multip|le -e co|
|00001820| 6d 2d 0d 20 20 20 20 20 | 6d 61 6e 64 73 20 6d 61 |m-. |mands ma|
|00001830| 79 20 62 65 20 67 69 76 | 65 6e 20 74 6f 20 62 75 |y be giv|en to bu|
|00001840| 69 6c 64 20 75 70 20 61 | 20 6d 75 6c 74 69 2d 6c |ild up a| multi-l|
|00001850| 69 6e 65 20 73 63 72 69 | 70 74 2e 20 20 49 66 20 |ine scri|pt. If |
|00001860| 2d 65 0d 20 20 20 20 20 | 69 73 20 67 69 76 65 6e |-e. |is given|
|00001870| 2c 20 70 65 72 6c 20 77 | 69 6c 6c 20 6e 6f 74 20 |, perl w|ill not |
|00001880| 6c 6f 6f 6b 20 66 6f 72 | 20 61 20 73 63 72 69 70 |look for| a scrip|
|00001890| 74 20 66 69 6c 65 6e 61 | 6d 65 20 69 6e 20 74 68 |t filena|me in th|
|000018a0| 65 0d 20 20 20 20 20 61 | 72 67 75 6d 65 6e 74 20 |e. a|rgument |
|000018b0| 6c 69 73 74 2e 0d 0d 2d | 69 65 78 74 65 6e 73 69 |list...-|iextensi|
|000018c0| 6f 6e 0d 20 20 20 20 20 | 73 70 65 63 69 66 69 65 |on. |specifie|
|000018d0| 73 20 74 68 61 74 20 66 | 69 6c 65 73 20 70 72 6f |s that f|iles pro|
|000018e0| 63 65 73 73 65 64 20 62 | 79 20 74 68 65 20 3c 3e |cessed b|y the <>|
|000018f0| 20 63 6f 6e 73 74 72 75 | 63 74 20 61 72 65 20 74 | constru|ct are t|
|00001900| 6f 20 62 65 0d 20 20 20 | 20 20 65 64 69 74 65 64 |o be. | edited|
|00001910| 20 69 6e 2d 70 6c 61 63 | 65 2e 20 20 49 74 20 64 | in-plac|e. It d|
|00001920| 6f 65 73 20 74 68 69 73 | 20 62 79 20 72 65 6e 61 |oes this| by rena|
|00001930| 6d 69 6e 67 20 74 68 65 | 20 69 6e 70 75 74 20 66 |ming the| input f|
|00001940| 69 6c 65 2c 0d 20 20 20 | 20 20 6f 70 65 6e 69 6e |ile,. | openin|
|00001950| 67 20 74 68 65 20 6f 75 | 74 70 75 74 20 66 69 6c |g the ou|tput fil|
|00001960| 65 20 62 79 20 74 68 65 | 20 73 61 6d 65 20 6e 61 |e by the| same na|
|00001970| 6d 65 2c 20 61 6e 64 20 | 73 65 6c 65 63 74 69 6e |me, and |selectin|
|00001980| 67 20 74 68 61 74 0d 20 | 20 20 20 20 6f 75 74 70 |g that. | outp|
|00001990| 75 74 20 66 69 6c 65 20 | 61 73 20 74 68 65 20 64 |ut file |as the d|
|000019a0| 65 66 61 75 6c 74 20 66 | 6f 72 20 70 72 69 6e 74 |efault f|or print|
|000019b0| 20 73 74 61 74 65 6d 65 | 6e 74 73 2e 20 20 54 68 | stateme|nts. Th|
|000019c0| 65 20 65 78 74 65 6e 2d | 0d 20 20 20 20 20 73 69 |e exten-|. si|
|000019d0| 6f 6e 2c 20 69 66 20 73 | 75 70 70 6c 69 65 64 2c |on, if s|upplied,|
|000019e0| 20 69 73 20 61 64 64 65 | 64 20 74 6f 20 74 68 65 | is adde|d to the|
|000019f0| 20 6e 61 6d 65 20 6f 66 | 20 74 68 65 20 6f 6c 64 | name of| the old|
|00001a00| 20 66 69 6c 65 20 74 6f | 0d 20 20 20 20 20 6d 61 | file to|. ma|
|00001a10| 6b 65 20 61 20 62 61 63 | 6b 75 70 20 63 6f 70 79 |ke a bac|kup copy|
|00001a20| 2e 20 20 49 66 20 6e 6f | 20 65 78 74 65 6e 73 69 |. If no| extensi|
|00001a30| 6f 6e 20 69 73 20 73 75 | 70 70 6c 69 65 64 2c 20 |on is su|pplied, |
|00001a40| 6e 6f 20 62 61 63 6b 75 | 70 0d 20 20 20 20 20 69 |no backu|p. i|
|00001a50| 73 20 6d 61 64 65 2e 20 | 20 53 61 79 69 6e 67 20 |s made. | Saying |
|00001a60| 22 70 65 72 6c 20 2d 70 | 20 2d 69 2e 62 61 6b 20 |"perl -p| -i.bak |
|00001a70| 2d 65 20 22 73 2f 66 6f | 6f 2f 62 61 72 2f 3b 22 |-e "s/fo|o/bar/;"|
|00001a80| 20 2e 2e 2e 20 22 20 69 | 73 0d 20 20 20 20 20 74 | ... " i|s. t|
|00001a90| 68 65 20 73 61 6d 65 20 | 61 73 20 75 73 69 6e 67 |he same |as using|
|00001aa0| 20 74 68 65 20 73 63 72 | 69 70 74 3a 0d 0d 20 20 | the scr|ipt:.. |
|00001ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ac0| 20 20 23 21 2f 75 73 72 | 2f 62 69 6e 2f 70 65 72 | #!/usr|/bin/per|
|00001ad0| 6c 20 2d 70 69 2e 62 61 | 6b 0d 20 20 20 20 20 20 |l -pi.ba|k. |
|00001ae0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 73 2f | | s/|
|00001af0| 66 6f 6f 2f 62 61 72 2f | 3b 0d 0d 20 20 20 20 20 |foo/bar/|;.. |
|00001b00| 77 68 69 63 68 20 69 73 | 20 65 71 75 69 76 61 6c |which is| equival|
|00001b10| 65 6e 74 20 74 6f 0d 0d | 20 20 20 20 20 20 20 20 |ent to..| |
|00001b20| 20 20 20 20 20 20 20 20 | 20 20 20 20 23 21 2f 75 | | #!/u|
|00001b30| 73 72 2f 62 69 6e 2f 70 | 65 72 6c 0d 20 20 20 20 |sr/bin/p|erl. |
|00001b40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b50| 77 68 69 6c 65 20 28 3c | 3e 29 20 7b 0d 20 20 20 |while (<|>) {. |
|00001b60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b70| 20 20 20 20 20 20 69 66 | 20 28 24 41 52 47 56 20 | if| ($ARGV |
|00001b80| 6e 65 20 24 6f 6c 64 61 | 72 67 76 29 20 7b 0d 20 |ne $olda|rgv) {. |
|00001b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ba0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 72 65 6e | | ren|
|00001bb0| 61 6d 65 28 24 41 52 47 | 56 2c 20 24 41 52 47 56 |ame($ARG|V, $ARGV|
|00001bc0| 20 2e 20 27 2e 62 61 6b | 27 29 3b 0d 20 20 20 20 | . '.bak|');. |
|00001bd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001be0| 20 20 20 20 20 20 20 20 | 20 20 6f 70 65 6e 28 41 | | open(A|
|00001bf0| 52 47 56 4f 55 54 2c 20 | 22 3e 24 41 52 47 56 22 |RGVOUT, |">$ARGV"|
|00001c00| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |);. | |
|00001c10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c20| 20 73 65 6c 65 63 74 28 | 41 52 47 56 4f 55 54 29 | select(|ARGVOUT)|
|00001c30| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00001c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c50| 24 6f 6c 64 61 72 67 76 | 20 3d 20 24 41 52 47 56 |$oldargv| = $ARGV|
|00001c60| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00001c70| 20 20 20 20 20 20 20 20 | 20 20 20 7d 0d 20 20 20 | | }. |
|00001c80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c90| 20 20 20 20 20 20 73 2f | 66 6f 6f 2f 62 61 72 2f | s/|foo/bar/|
|00001ca0| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00001cb0| 20 20 20 20 20 20 7d 0d | 20 20 20 20 20 20 20 20 | }.| |
|00001cc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 6f 6e 74 | | cont|
|00001cd0| 69 6e 75 65 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |inue {. | |
|00001ce0| 20 20 20 20 20 20 20 20 | 20 20 20 20 70 72 69 6e | | prin|
|00001cf0| 74 3b 20 20 20 20 20 23 | 20 74 68 69 73 20 70 72 |t; #| this pr|
|00001d00| 69 6e 74 73 20 74 6f 20 | 6f 72 69 67 69 6e 61 6c |ints to |original|
|00001d10| 20 66 69 6c 65 6e 61 6d | 65 0d 20 20 20 20 20 20 | filenam|e. |
|00001d20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 7d 0d | | }.|
|00001d30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001d40| 20 20 20 20 73 65 6c 65 | 63 74 28 53 54 44 4f 55 | sele|ct(STDOU|
|00001d50| 54 29 3b 0d 0d 20 20 20 | 20 20 65 78 63 65 70 74 |T);.. | except|
|00001d60| 20 74 68 61 74 20 74 68 | 65 20 2d 69 20 66 6f 72 | that th|e -i for|
|00001d70| 6d 20 64 6f 65 73 6e 27 | 74 20 6e 65 65 64 20 74 |m doesn'|t need t|
|00001d80| 6f 20 63 6f 6d 70 61 72 | 65 20 24 41 52 47 56 20 |o compar|e $ARGV |
|00001d90| 74 6f 0d 20 20 20 20 20 | 24 6f 6c 64 61 72 67 76 |to. |$oldargv|
|00001da0| 20 74 6f 20 6b 6e 6f 77 | 20 77 68 65 6e 20 74 68 | to know| when th|
|00001db0| 65 20 66 69 6c 65 6e 61 | 6d 65 20 68 61 73 20 63 |e filena|me has c|
|00001dc0| 68 61 6e 67 65 64 2e 20 | 20 49 74 20 64 6f 65 73 |hanged. | It does|
|00001dd0| 2c 0d 20 20 20 20 20 68 | 6f 77 65 76 65 72 2c 20 |,. h|owever, |
|00001de0| 75 73 65 20 41 52 47 56 | 4f 55 54 20 66 6f 72 20 |use ARGV|OUT for |
|00001df0| 74 68 65 20 73 65 6c 65 | 63 74 65 64 20 66 69 6c |the sele|cted fil|
|00001e00| 65 68 61 6e 64 6c 65 2e | 20 20 4e 6f 74 65 20 74 |ehandle.| Note t|
|00001e10| 68 61 74 0d 20 20 20 20 | 20 53 54 44 4f 55 54 20 |hat. | STDOUT |
|00001e20| 69 73 20 72 65 73 74 6f | 72 65 64 20 61 73 20 74 |is resto|red as t|
|00001e30| 68 65 20 64 65 66 61 75 | 6c 74 20 6f 75 74 70 75 |he defau|lt outpu|
|00001e40| 74 20 66 69 6c 65 68 61 | 6e 64 6c 65 20 61 66 74 |t fileha|ndle aft|
|00001e50| 65 72 0d 20 20 20 20 20 | 74 68 65 20 6c 6f 6f 70 |er. |the loop|
|00001e60| 2e 0d 0d 20 20 20 20 20 | 59 6f 75 20 63 61 6e 20 |... |You can |
|00001e70| 75 73 65 20 65 6f 66 20 | 74 6f 20 6c 6f 63 61 74 |use eof |to locat|
|00001e80| 65 20 74 68 65 20 65 6e | 64 20 6f 66 20 65 61 63 |e the en|d of eac|
|00001e90| 68 20 69 6e 70 75 74 20 | 66 69 6c 65 2c 20 69 6e |h input |file, in|
|00001ea0| 0d 20 20 20 20 20 63 61 | 73 65 20 79 6f 75 20 77 |. ca|se you w|
|00001eb0| 61 6e 74 20 74 6f 20 61 | 70 70 65 6e 64 20 74 6f |ant to a|ppend to|
|00001ec0| 20 65 61 63 68 20 66 69 | 6c 65 2c 20 6f 72 20 72 | each fi|le, or r|
|00001ed0| 65 73 65 74 20 6c 69 6e | 65 20 6e 75 6d 62 65 72 |eset lin|e number|
|00001ee0| 2d 0d 20 20 20 20 20 69 | 6e 67 20 28 73 65 65 20 |-. i|ng (see |
|00001ef0| 65 78 61 6d 70 6c 65 20 | 75 6e 64 65 72 20 65 6f |example |under eo|
|00001f00| 66 29 2e 0d 0d 2d 49 64 | 69 72 65 63 74 6f 72 79 |f)...-Id|irectory|
|00001f10| 0d 20 20 20 20 20 6d 61 | 79 20 62 65 20 75 73 65 |. ma|y be use|
|00001f20| 64 20 69 6e 20 63 6f 6e | 6a 75 6e 63 74 69 6f 6e |d in con|junction|
|00001f30| 20 77 69 74 68 20 2d 50 | 20 74 6f 20 74 65 6c 6c | with -P| to tell|
|00001f40| 20 74 68 65 20 43 20 70 | 72 65 70 72 6f 63 65 73 | the C p|reproces|
|00001f50| 2d 0d 20 20 20 20 20 73 | 6f 72 20 77 68 65 72 65 |-. s|or where|
|00001f60| 20 74 6f 20 6c 6f 6f 6b | 20 66 6f 72 20 69 6e 63 | to look| for inc|
|00001f70| 6c 75 64 65 20 66 69 6c | 65 73 2e 20 20 42 79 20 |lude fil|es. By |
|00001f80| 64 65 66 61 75 6c 74 0d | 20 20 20 20 20 2f 75 73 |default.| /us|
|00001f90| 72 2f 69 6e 63 6c 75 64 | 65 20 61 6e 64 20 2f 75 |r/includ|e and /u|
|00001fa0| 73 72 2f 6c 69 62 2f 70 | 65 72 6c 20 61 72 65 20 |sr/lib/p|erl are |
|00001fb0| 73 65 61 72 63 68 65 64 | 2e 0d 0d 2d 6c 6f 63 74 |searched|...-loct|
|00001fc0| 6e 75 6d 0d 20 20 20 20 | 20 65 6e 61 62 6c 65 73 |num. | enables|
|00001fd0| 20 61 75 74 6f 6d 61 74 | 69 63 20 6c 69 6e 65 2d | automat|ic line-|
|00001fe0| 65 6e 64 69 6e 67 20 70 | 72 6f 63 65 73 73 69 6e |ending p|rocessin|
|00001ff0| 67 2e 20 20 49 74 20 68 | 61 73 20 74 77 6f 0d 20 |g. It h|as two. |
|00002000| 20 20 20 20 65 66 66 65 | 63 74 73 3a 20 66 69 72 | effe|cts: fir|
|00002010| 73 74 2c 20 69 74 20 61 | 75 74 6f 6d 61 74 69 63 |st, it a|utomatic|
|00002020| 61 6c 6c 79 20 63 68 6f | 70 73 20 74 68 65 20 6c |ally cho|ps the l|
|00002030| 69 6e 65 20 74 65 72 6d | 69 6e 61 74 6f 72 0d 20 |ine term|inator. |
|00002040| 20 20 20 20 77 68 65 6e | 20 75 73 65 64 20 77 69 | when| used wi|
|00002050| 74 68 20 2d 6e 20 6f 72 | 20 2d 70 20 2c 20 61 6e |th -n or| -p , an|
|00002060| 64 20 73 65 63 6f 6e 64 | 2c 20 69 74 20 61 73 73 |d second|, it ass|
|00002070| 69 67 6e 73 20 24 5c 20 | 74 6f 20 68 61 76 65 0d |igns $\ |to have.|
|00002080| 20 20 20 20 20 74 68 65 | 20 76 61 6c 75 65 20 6f | the| value o|
|00002090| 66 20 6f 63 74 6e 75 6d | 20 73 6f 20 74 68 61 74 |f octnum| so that|
|000020a0| 20 61 6e 79 20 70 72 69 | 6e 74 20 73 74 61 74 65 | any pri|nt state|
|000020b0| 6d 65 6e 74 73 20 77 69 | 6c 6c 20 68 61 76 65 0d |ments wi|ll have.|
|000020c0| 20 20 20 20 20 74 68 61 | 74 20 6c 69 6e 65 20 74 | tha|t line t|
|000020d0| 65 72 6d 69 6e 61 74 6f | 72 20 61 64 64 65 64 20 |erminato|r added |
|000020e0| 62 61 63 6b 20 6f 6e 2e | 20 20 49 66 20 6f 63 74 |back on.| If oct|
|000020f0| 6e 75 6d 20 69 73 20 6f | 6d 69 74 74 65 64 2c 0d |num is o|mitted,.|
|00002100| 20 20 20 20 20 73 65 74 | 73 20 24 5c 20 74 6f 20 | set|s $\ to |
|00002110| 74 68 65 20 63 75 72 72 | 65 6e 74 20 76 61 6c 75 |the curr|ent valu|
|00002120| 65 20 6f 66 20 24 2f 2e | 20 20 46 6f 72 20 69 6e |e of $/.| For in|
|00002130| 73 74 61 6e 63 65 2c 20 | 74 6f 20 74 72 69 6d 0d |stance, |to trim.|
|00002140| 20 20 20 20 20 6c 69 6e | 65 73 20 74 6f 20 38 30 | lin|es to 80|
|00002150| 20 63 6f 6c 75 6d 6e 73 | 3a 0d 0d 20 20 20 20 20 | columns|:.. |
|00002160| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 70 | | p|
|00002170| 65 72 6c 20 2d 6c 70 65 | 20 27 73 75 62 73 74 72 |erl -lpe| 'substr|
|00002180| 28 24 5f 2c 20 38 30 29 | 20 3d 20 22 22 27 0d 0d |($_, 80)| = ""'..|
|00002190| 20 20 20 20 20 4e 6f 74 | 65 20 74 68 61 74 20 74 | Not|e that t|
|000021a0| 68 65 20 61 73 73 69 67 | 6e 6d 65 6e 74 20 24 5c |he assig|nment $\|
|000021b0| 20 3d 20 24 2f 20 69 73 | 20 64 6f 6e 65 20 77 68 | = $/ is| done wh|
|000021c0| 65 6e 20 74 68 65 20 73 | 77 69 74 63 68 20 69 73 |en the s|witch is|
|000021d0| 0d 20 20 20 20 20 70 72 | 6f 63 65 73 73 65 64 2c |. pr|ocessed,|
|000021e0| 20 73 6f 20 74 68 65 20 | 69 6e 70 75 74 20 72 65 | so the |input re|
|000021f0| 63 6f 72 64 20 73 65 70 | 61 72 61 74 6f 72 20 63 |cord sep|arator c|
|00002200| 61 6e 20 62 65 20 64 69 | 66 66 65 72 65 6e 74 0d |an be di|fferent.|
|00002210| 20 20 20 20 20 74 68 61 | 6e 20 74 68 65 20 6f 75 | tha|n the ou|
|00002220| 74 70 75 74 20 72 65 63 | 6f 72 64 20 73 65 70 61 |tput rec|ord sepa|
|00002230| 72 61 74 6f 72 20 69 66 | 20 74 68 65 20 2d 6c 20 |rator if| the -l |
|00002240| 73 77 69 74 63 68 20 69 | 73 20 66 6f 6c 2d 0d 20 |switch i|s fol-. |
|00002250| 20 20 20 20 6c 6f 77 65 | 64 20 62 79 20 61 20 2d | lowe|d by a -|
|00002260| 30 20 73 77 69 74 63 68 | 3a 0d 0d 20 20 20 20 20 |0 switch|:.. |
|00002270| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 67 | | g|
|00002280| 6e 75 66 69 6e 64 20 2f | 20 2d 70 72 69 6e 74 30 |nufind /| -print0|
|00002290| 20 7c 20 70 65 72 6c 20 | 2d 6c 6e 30 65 20 27 70 | | perl |-ln0e 'p|
|000022a0| 72 69 6e 74 20 22 66 6f | 75 6e 64 20 24 5f 22 20 |rint "fo|und $_" |
|000022b0| 69 66 20 2d 70 27 0d 0d | 20 20 20 20 20 54 68 69 |if -p'..| Thi|
|000022c0| 73 20 73 65 74 73 20 24 | 5c 20 74 6f 20 6e 65 77 |s sets $|\ to new|
|000022d0| 6c 69 6e 65 20 61 6e 64 | 20 74 68 65 6e 20 73 65 |line and| then se|
|000022e0| 74 73 20 24 2f 20 74 6f | 20 74 68 65 20 6e 75 6c |ts $/ to| the nul|
|000022f0| 6c 20 63 68 61 72 61 63 | 2d 0d 20 20 20 20 20 74 |l charac|-. t|
|00002300| 65 72 2e 0d 0d 2d 6e 20 | 20 20 63 61 75 73 65 73 |er...-n | causes|
|00002310| 20 70 65 72 6c 20 74 6f | 20 61 73 73 75 6d 65 20 | perl to| assume |
|00002320| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 6c 6f |the foll|owing lo|
|00002330| 6f 70 20 61 72 6f 75 6e | 64 20 79 6f 75 72 20 73 |op aroun|d your s|
|00002340| 63 72 69 70 74 2c 0d 20 | 20 20 20 20 77 68 69 63 |cript,. | whic|
|00002350| 68 20 6d 61 6b 65 73 20 | 69 74 20 69 74 65 72 61 |h makes |it itera|
|00002360| 74 65 20 6f 76 65 72 20 | 66 69 6c 65 6e 61 6d 65 |te over |filename|
|00002370| 20 61 72 67 75 6d 65 6e | 74 73 20 73 6f 6d 65 77 | argumen|ts somew|
|00002380| 68 61 74 20 6c 69 6b 65 | 0d 20 20 20 20 20 22 73 |hat like|. "s|
|00002390| 65 64 20 2d 6e 22 20 6f | 72 20 61 77 6b 3a 0d 0d |ed -n" o|r awk:..|
|000023a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000023b0| 20 20 20 20 77 68 69 6c | 65 20 28 3c 3e 29 20 7b | whil|e (<>) {|
|000023c0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000023d0| 20 20 20 20 20 20 20 20 | 20 20 2e 2e 2e 20 20 20 | | ... |
|000023e0| 20 20 20 20 23 20 79 6f | 75 72 20 73 63 72 69 70 | # yo|ur scrip|
|000023f0| 74 20 67 6f 65 73 20 68 | 65 72 65 0d 20 20 20 20 |t goes h|ere. |
|00002400| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002410| 7d 0d 0d 20 20 20 20 20 | 4e 6f 74 65 20 74 68 61 |}.. |Note tha|
|00002420| 74 20 74 68 65 20 6c 69 | 6e 65 73 20 61 72 65 20 |t the li|nes are |
|00002430| 6e 6f 74 20 70 72 69 6e | 74 65 64 20 62 79 20 64 |not prin|ted by d|
|00002440| 65 66 61 75 6c 74 2e 20 | 20 53 65 65 20 2d 70 20 |efault. | See -p |
|00002450| 74 6f 0d 20 20 20 20 20 | 68 61 76 65 20 6c 69 6e |to. |have lin|
|00002460| 65 73 20 70 72 69 6e 74 | 65 64 2e 20 20 48 65 72 |es print|ed. Her|
|00002470| 65 20 69 73 20 61 6e 20 | 65 66 66 69 63 69 65 6e |e is an |efficien|
|00002480| 74 20 77 61 79 20 74 6f | 20 64 65 6c 65 74 65 20 |t way to| delete |
|00002490| 61 6c 6c 0d 20 20 20 20 | 20 66 69 6c 65 73 20 6f |all. | files o|
|000024a0| 6c 64 65 72 20 74 68 61 | 6e 20 61 20 77 65 65 6b |lder tha|n a week|
|000024b0| 3a 0d 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |:.. | |
|000024c0| 20 20 20 20 20 20 20 66 | 69 6e 64 20 2e 20 2d 6d | f|ind . -m|
|000024d0| 74 69 6d 65 20 2b 37 20 | 2d 70 72 69 6e 74 20 7c |time +7 |-print ||
|000024e0| 20 70 65 72 6c 20 2d 6e | 6c 65 20 27 75 6e 6c 69 | perl -n|le 'unli|
|000024f0| 6e 6b 3b 27 0d 0d 20 20 | 20 20 20 54 68 69 73 20 |nk;'.. | This |
|00002500| 69 73 20 66 61 73 74 65 | 72 20 74 68 61 6e 20 75 |is faste|r than u|
|00002510| 73 69 6e 67 20 74 68 65 | 20 2d 65 78 65 63 20 73 |sing the| -exec s|
|00002520| 77 69 74 63 68 20 6f 66 | 20 66 69 6e 64 20 62 65 |witch of| find be|
|00002530| 63 61 75 73 65 0d 20 20 | 20 20 20 79 6f 75 20 64 |cause. | you d|
|00002540| 6f 6e 27 74 20 68 61 76 | 65 20 74 6f 20 73 74 61 |on't hav|e to sta|
|00002550| 72 74 20 61 20 70 72 6f | 63 65 73 73 20 6f 6e 20 |rt a pro|cess on |
|00002560| 65 76 65 72 79 20 66 69 | 6c 65 6e 61 6d 65 20 66 |every fi|lename f|
|00002570| 6f 75 6e 64 2e 0d 0d 2d | 70 20 20 20 63 61 75 73 |ound...-|p caus|
|00002580| 65 73 20 70 65 72 6c 20 | 74 6f 20 61 73 73 75 6d |es perl |to assum|
|00002590| 65 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e the fo|llowing |
|000025a0| 6c 6f 6f 70 20 61 72 6f | 75 6e 64 20 79 6f 75 72 |loop aro|und your|
|000025b0| 20 73 63 72 69 70 74 2c | 0d 20 20 20 20 20 77 68 | script,|. wh|
|000025c0| 69 63 68 20 6d 61 6b 65 | 73 20 69 74 20 69 74 65 |ich make|s it ite|
|000025d0| 72 61 74 65 20 6f 76 65 | 72 20 66 69 6c 65 6e 61 |rate ove|r filena|
|000025e0| 6d 65 20 61 72 67 75 6d | 65 6e 74 73 20 73 6f 6d |me argum|ents som|
|000025f0| 65 77 68 61 74 20 6c 69 | 6b 65 0d 20 20 20 20 20 |ewhat li|ke. |
|00002600| 73 65 64 3a 0d 0d 20 20 | 20 20 20 20 20 20 20 20 |sed:.. | |
|00002610| 20 20 20 20 20 20 20 20 | 20 20 77 68 69 6c 65 20 | | while |
|00002620| 28 3c 3e 29 20 7b 0d 20 | 20 20 20 20 20 20 20 20 |(<>) {. | |
|00002630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002640| 2e 2e 2e 20 20 20 20 20 | 20 20 23 20 79 6f 75 72 |... | # your|
|00002650| 20 73 63 72 69 70 74 20 | 67 6f 65 73 20 68 65 72 | script |goes her|
|00002660| 65 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e. | |
|00002670| 20 20 20 20 20 20 7d 20 | 63 6f 6e 74 69 6e 75 65 | } |continue|
|00002680| 20 7b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | {. | |
|00002690| 20 20 20 20 20 20 20 20 | 20 20 20 20 70 72 69 6e | | prin|
|000026a0| 74 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |t;. | |
|000026b0| 20 20 20 20 20 20 20 7d | 0d 0d 20 20 20 20 20 4e | }|.. N|
|000026c0| 6f 74 65 20 74 68 61 74 | 20 74 68 65 20 6c 69 6e |ote that| the lin|
|000026d0| 65 73 20 61 72 65 20 70 | 72 69 6e 74 65 64 20 61 |es are p|rinted a|
|000026e0| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 2e 20 20 54 |utomatic|ally. T|
|000026f0| 6f 20 73 75 70 70 72 65 | 73 73 0d 20 20 20 20 20 |o suppre|ss. |
|00002700| 70 72 69 6e 74 69 6e 67 | 20 75 73 65 20 74 68 65 |printing| use the|
|00002710| 20 2d 6e 20 73 77 69 74 | 63 68 2e 20 20 41 20 2d | -n swit|ch. A -|
|00002720| 70 20 6f 76 65 72 72 69 | 64 65 73 20 61 20 2d 6e |p overri|des a -n|
|00002730| 20 73 77 69 74 63 68 2e | 0d 0d 2d 50 20 20 20 63 | switch.|..-P c|
|00002740| 61 75 73 65 73 20 79 6f | 75 72 20 73 63 72 69 70 |auses yo|ur scrip|
|00002750| 74 20 74 6f 20 62 65 20 | 72 75 6e 20 74 68 72 6f |t to be |run thro|
|00002760| 75 67 68 20 74 68 65 20 | 43 20 70 72 65 70 72 6f |ugh the |C prepro|
|00002770| 63 65 73 73 6f 72 0d 20 | 20 20 20 20 62 65 66 6f |cessor. | befo|
|00002780| 72 65 20 63 6f 6d 70 69 | 6c 61 74 69 6f 6e 20 62 |re compi|lation b|
|00002790| 79 20 70 65 72 6c 2e 20 | 20 28 53 69 6e 63 65 20 |y perl. | (Since |
|000027a0| 62 6f 74 68 20 63 6f 6d | 6d 65 6e 74 73 20 61 6e |both com|ments an|
|000027b0| 64 20 63 70 70 0d 20 20 | 20 20 20 64 69 72 65 63 |d cpp. | direc|
|000027c0| 74 69 76 65 73 20 62 65 | 67 69 6e 20 77 69 74 68 |tives be|gin with|
|000027d0| 20 74 68 65 20 23 20 63 | 68 61 72 61 63 74 65 72 | the # c|haracter|
|000027e0| 2c 20 79 6f 75 20 73 68 | 6f 75 6c 64 20 61 76 6f |, you sh|ould avo|
|000027f0| 69 64 0d 20 20 20 20 20 | 73 74 61 72 74 69 6e 67 |id. |starting|
|00002800| 20 63 6f 6d 6d 65 6e 74 | 73 20 77 69 74 68 20 61 | comment|s with a|
|00002810| 6e 79 20 77 6f 72 64 73 | 20 72 65 63 6f 67 6e 69 |ny words| recogni|
|00002820| 7a 65 64 20 62 79 20 74 | 68 65 20 43 20 70 72 65 |zed by t|he C pre|
|00002830| 70 72 6f 2d 0d 20 20 20 | 20 20 63 65 73 73 6f 72 |pro-. | cessor|
|00002840| 20 73 75 63 68 20 61 73 | 20 22 69 66 22 2c 20 22 | such as| "if", "|
|00002850| 65 6c 73 65 22 20 6f 72 | 20 22 64 65 66 69 6e 65 |else" or| "define|
|00002860| 22 2e 29 0d 0d 2d 73 20 | 20 20 65 6e 61 62 6c 65 |".)..-s | enable|
|00002870| 73 20 73 6f 6d 65 20 72 | 75 64 69 6d 65 6e 74 61 |s some r|udimenta|
|00002880| 72 79 20 73 77 69 74 63 | 68 20 70 61 72 73 69 6e |ry switc|h parsin|
|00002890| 67 20 66 6f 72 20 73 77 | 69 74 63 68 65 73 20 6f |g for sw|itches o|
|000028a0| 6e 20 74 68 65 0d 20 20 | 20 20 20 63 6f 6d 6d 61 |n the. | comma|
|000028b0| 6e 64 20 6c 69 6e 65 20 | 61 66 74 65 72 20 74 68 |nd line |after th|
|000028c0| 65 20 73 63 72 69 70 74 | 20 6e 61 6d 65 20 62 75 |e script| name bu|
|000028d0| 74 20 62 65 66 6f 72 65 | 20 61 6e 79 20 66 69 6c |t before| any fil|
|000028e0| 65 6e 61 6d 65 0d 20 20 | 20 20 20 61 72 67 75 6d |ename. | argum|
|000028f0| 65 6e 74 73 20 28 6f 72 | 20 62 65 66 6f 72 65 20 |ents (or| before |
|00002900| 61 20 2d 2d 29 2e 20 20 | 41 6e 79 20 73 77 69 74 |a --). |Any swit|
|00002910| 63 68 20 66 6f 75 6e 64 | 20 74 68 65 72 65 20 69 |ch found| there i|
|00002920| 73 0d 20 20 20 20 20 72 | 65 6d 6f 76 65 64 20 66 |s. r|emoved f|
|00002930| 72 6f 6d 20 40 41 52 47 | 56 20 61 6e 64 20 73 65 |rom @ARG|V and se|
|00002940| 74 73 20 74 68 65 20 63 | 6f 72 72 65 73 70 6f 6e |ts the c|orrespon|
|00002950| 64 69 6e 67 20 76 61 72 | 69 61 62 6c 65 20 69 6e |ding var|iable in|
|00002960| 0d 20 20 20 20 20 74 68 | 65 20 70 65 72 6c 20 73 |. th|e perl s|
|00002970| 63 72 69 70 74 2e 20 20 | 54 68 65 20 66 6f 6c 6c |cript. |The foll|
|00002980| 6f 77 69 6e 67 20 73 63 | 72 69 70 74 20 70 72 69 |owing sc|ript pri|
|00002990| 6e 74 73 20 22 74 72 75 | 65 22 20 69 66 20 61 6e |nts "tru|e" if an|
|000029a0| 64 0d 20 20 20 20 20 6f | 6e 6c 79 20 69 66 20 74 |d. o|nly if t|
|000029b0| 68 65 20 73 63 72 69 70 | 74 20 69 73 20 69 6e 76 |he scrip|t is inv|
|000029c0| 6f 6b 65 64 20 77 69 74 | 68 20 61 20 2d 78 79 7a |oked wit|h a -xyz|
|000029d0| 20 73 77 69 74 63 68 2e | 0d 0d 20 20 20 20 20 20 | switch.|.. |
|000029e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 23 21 | | #!|
|000029f0| 2f 75 73 72 2f 62 69 6e | 2f 70 65 72 6c 20 2d 73 |/usr/bin|/perl -s|
|00002a00| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00002a10| 20 20 20 20 20 69 66 20 | 28 24 78 79 7a 29 20 7b | if |($xyz) {|
|00002a20| 20 70 72 69 6e 74 20 22 | 74 72 75 65 5c 6e 22 3b | print "|true\n";|
|00002a30| 20 7d 0d 0d 0d 2d 53 20 | 20 20 6d 61 6b 65 73 20 | }...-S | makes |
|00002a40| 70 65 72 6c 20 75 73 65 | 20 74 68 65 20 50 41 54 |perl use| the PAT|
|00002a50| 48 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 20 76 61 |H enviro|nment va|
|00002a60| 72 69 61 62 6c 65 20 74 | 6f 20 73 65 61 72 63 68 |riable t|o search|
|00002a70| 20 66 6f 72 0d 20 20 20 | 20 20 74 68 65 20 73 63 | for. | the sc|
|00002a80| 72 69 70 74 20 28 75 6e | 6c 65 73 73 20 74 68 65 |ript (un|less the|
|00002a90| 20 6e 61 6d 65 20 6f 66 | 20 74 68 65 20 73 63 72 | name of| the scr|
|00002aa0| 69 70 74 20 73 74 61 72 | 74 73 20 77 69 74 68 20 |ipt star|ts with |
|00002ab0| 61 0d 20 20 20 20 20 73 | 6c 61 73 68 29 2e 20 20 |a. s|lash). |
|00002ac0| 54 79 70 69 63 61 6c 6c | 79 20 74 68 69 73 20 69 |Typicall|y this i|
|00002ad0| 73 20 75 73 65 64 20 74 | 6f 20 65 6d 75 6c 61 74 |s used t|o emulat|
|00002ae0| 65 20 23 21 20 73 74 61 | 72 74 75 70 20 6f 6e 0d |e #! sta|rtup on.|
|00002af0| 20 20 20 20 20 6d 61 63 | 68 69 6e 65 73 20 74 68 | mac|hines th|
|00002b00| 61 74 20 64 6f 6e 27 74 | 20 73 75 70 70 6f 72 74 |at don't| support|
|00002b10| 20 23 21 2c 20 69 6e 20 | 74 68 65 20 66 6f 6c 6c | #!, in |the foll|
|00002b20| 6f 77 69 6e 67 20 6d 61 | 6e 6e 65 72 3a 0d 0d 20 |owing ma|nner:.. |
|00002b30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002b40| 20 20 20 23 21 2f 75 73 | 72 2f 62 69 6e 2f 70 65 | #!/us|r/bin/pe|
|00002b50| 72 6c 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |rl. | |
|00002b60| 20 20 20 20 20 20 20 65 | 76 61 6c 20 22 65 78 65 | e|val "exe|
|00002b70| 63 20 2f 75 73 72 2f 62 | 69 6e 2f 70 65 72 6c 20 |c /usr/b|in/perl |
|00002b80| 2d 53 20 24 30 20 24 2a | 22 0d 20 20 20 20 20 20 |-S $0 $*|". |
|00002b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ba0| 20 20 20 69 66 20 24 72 | 75 6e 6e 69 6e 67 5f 75 | if $r|unning_u|
|00002bb0| 6e 64 65 72 5f 73 6f 6d | 65 5f 73 68 65 6c 6c 3b |nder_som|e_shell;|
|00002bc0| 0d 0d 20 20 20 20 20 54 | 68 65 20 73 79 73 74 65 |.. T|he syste|
|00002bd0| 6d 20 69 67 6e 6f 72 65 | 73 20 74 68 65 20 66 69 |m ignore|s the fi|
|00002be0| 72 73 74 20 6c 69 6e 65 | 20 61 6e 64 20 66 65 65 |rst line| and fee|
|00002bf0| 64 73 20 74 68 65 20 73 | 63 72 69 70 74 20 74 6f |ds the s|cript to|
|00002c00| 0d 20 20 20 20 20 2f 62 | 69 6e 2f 73 68 2c 20 77 |. /b|in/sh, w|
|00002c10| 68 69 63 68 20 70 72 6f | 63 65 65 64 73 20 74 6f |hich pro|ceeds to|
|00002c20| 20 74 72 79 20 74 6f 20 | 65 78 65 63 75 74 65 20 | try to |execute |
|00002c30| 74 68 65 20 70 65 72 6c | 20 73 63 72 69 70 74 20 |the perl| script |
|00002c40| 61 73 0d 20 20 20 20 20 | 61 20 73 68 65 6c 6c 20 |as. |a shell |
|00002c50| 73 63 72 69 70 74 2e 20 | 20 54 68 65 20 73 68 65 |script. | The she|
|00002c60| 6c 6c 20 65 78 65 63 75 | 74 65 73 20 74 68 65 20 |ll execu|tes the |
|00002c70| 73 65 63 6f 6e 64 20 6c | 69 6e 65 20 61 73 20 61 |second l|ine as a|
|00002c80| 0d 20 20 20 20 20 6e 6f | 72 6d 61 6c 20 73 68 65 |. no|rmal she|
|00002c90| 6c 6c 20 63 6f 6d 6d 61 | 6e 64 2c 20 61 6e 64 20 |ll comma|nd, and |
|00002ca0| 74 68 75 73 20 73 74 61 | 72 74 73 20 75 70 20 74 |thus sta|rts up t|
|00002cb0| 68 65 20 70 65 72 6c 20 | 69 6e 74 65 72 2d 0d 20 |he perl |inter-. |
|00002cc0| 20 20 20 20 70 72 65 74 | 65 72 2e 20 20 4f 6e 20 | pret|er. On |
|00002cd0| 73 6f 6d 65 20 73 79 73 | 74 65 6d 73 20 24 30 20 |some sys|tems $0 |
|00002ce0| 64 6f 65 73 6e 27 74 20 | 61 6c 77 61 79 73 20 63 |doesn't |always c|
|00002cf0| 6f 6e 74 61 69 6e 20 74 | 68 65 20 66 75 6c 6c 0d |ontain t|he full.|
|00002d00| 20 20 20 20 20 70 61 74 | 68 6e 61 6d 65 2c 20 73 | pat|hname, s|
|00002d10| 6f 20 74 68 65 20 2d 53 | 20 74 65 6c 6c 73 20 70 |o the -S| tells p|
|00002d20| 65 72 6c 20 74 6f 20 73 | 65 61 72 63 68 20 66 6f |erl to s|earch fo|
|00002d30| 72 20 74 68 65 20 73 63 | 72 69 70 74 20 69 66 0d |r the sc|ript if.|
|00002d40| 20 20 20 20 20 6e 65 63 | 65 73 73 61 72 79 2e 20 | nec|essary. |
|00002d50| 20 41 66 74 65 72 20 70 | 65 72 6c 20 6c 6f 63 61 | After p|erl loca|
|00002d60| 74 65 73 20 74 68 65 20 | 73 63 72 69 70 74 2c 20 |tes the |script, |
|00002d70| 69 74 20 70 61 72 73 65 | 73 20 74 68 65 0d 20 20 |it parse|s the. |
|00002d80| 20 20 20 6c 69 6e 65 73 | 20 61 6e 64 20 69 67 6e | lines| and ign|
|00002d90| 6f 72 65 73 20 74 68 65 | 6d 20 62 65 63 61 75 73 |ores the|m becaus|
|00002da0| 65 20 74 68 65 20 76 61 | 72 69 61 62 6c 65 0d 20 |e the va|riable. |
|00002db0| 20 20 20 20 24 72 75 6e | 6e 69 6e 67 5f 75 6e 64 | $run|ning_und|
|00002dc0| 65 72 5f 73 6f 6d 65 5f | 73 68 65 6c 6c 20 69 73 |er_some_|shell is|
|00002dd0| 20 6e 65 76 65 72 20 74 | 72 75 65 2e 20 20 41 20 | never t|rue. A |
|00002de0| 62 65 74 74 65 72 20 63 | 6f 6e 73 74 72 75 63 74 |better c|onstruct|
|00002df0| 0d 20 20 20 20 20 74 68 | 61 6e 20 24 2a 20 77 6f |. th|an $* wo|
|00002e00| 75 6c 64 20 62 65 20 24 | 7b 31 2b 22 24 40 22 7d |uld be $|{1+"$@"}|
|00002e10| 2c 20 77 68 69 63 68 20 | 68 61 6e 64 6c 65 73 20 |, which |handles |
|00002e20| 65 6d 62 65 64 64 65 64 | 20 73 70 61 63 65 73 0d |embedded| spaces.|
|00002e30| 20 20 20 20 20 61 6e 64 | 20 73 75 63 68 20 69 6e | and| such in|
|00002e40| 20 74 68 65 20 66 69 6c | 65 6e 61 6d 65 73 2c 20 | the fil|enames, |
|00002e50| 62 75 74 20 64 6f 65 73 | 6e 27 74 20 77 6f 72 6b |but does|n't work|
|00002e60| 20 69 66 20 74 68 65 20 | 73 63 72 69 70 74 20 69 | if the |script i|
|00002e70| 73 0d 20 20 20 20 20 62 | 65 69 6e 67 20 69 6e 74 |s. b|eing int|
|00002e80| 65 72 70 72 65 74 65 64 | 20 62 79 20 63 73 68 2e |erpreted| by csh.|
|00002e90| 20 20 49 6e 20 6f 72 64 | 65 72 20 74 6f 20 73 74 | In ord|er to st|
|00002ea0| 61 72 74 20 75 70 20 73 | 68 20 72 61 74 68 65 72 |art up s|h rather|
|00002eb0| 0d 20 20 20 20 20 74 68 | 61 6e 20 63 73 68 2c 20 |. th|an csh, |
|00002ec0| 73 6f 6d 65 20 73 79 73 | 74 65 6d 73 20 6d 61 79 |some sys|tems may|
|00002ed0| 20 68 61 76 65 20 74 6f | 20 72 65 70 6c 61 63 65 | have to| replace|
|00002ee0| 20 74 68 65 20 23 21 20 | 6c 69 6e 65 20 77 69 74 | the #! |line wit|
|00002ef0| 68 0d 20 20 20 20 20 61 | 20 6c 69 6e 65 20 63 6f |h. a| line co|
|00002f00| 6e 74 61 69 6e 69 6e 67 | 20 6a 75 73 74 20 61 20 |ntaining| just a |
|00002f10| 63 6f 6c 6f 6e 2c 20 77 | 68 69 63 68 20 77 69 6c |colon, w|hich wil|
|00002f20| 6c 20 62 65 20 70 6f 6c | 69 74 65 6c 79 0d 20 20 |l be pol|itely. |
|00002f30| 20 20 20 69 67 6e 6f 72 | 65 64 20 62 79 20 70 65 | ignor|ed by pe|
|00002f40| 72 6c 2e 20 20 4f 74 68 | 65 72 20 73 79 73 74 65 |rl. Oth|er syste|
|00002f50| 6d 73 20 63 61 6e 27 74 | 20 63 6f 6e 74 72 6f 6c |ms can't| control|
|00002f60| 20 74 68 61 74 2c 20 61 | 6e 64 20 6e 65 65 64 0d | that, a|nd need.|
|00002f70| 20 20 20 20 20 61 20 74 | 6f 74 61 6c 6c 79 20 64 | a t|otally d|
|00002f80| 65 76 69 6f 75 73 20 63 | 6f 6e 73 74 72 75 63 74 |evious c|onstruct|
|00002f90| 20 74 68 61 74 20 77 69 | 6c 6c 20 77 6f 72 6b 20 | that wi|ll work |
|00002fa0| 75 6e 64 65 72 20 61 6e | 79 20 6f 66 20 63 73 68 |under an|y of csh|
|00002fb0| 2c 0d 20 20 20 20 20 73 | 68 20 6f 72 20 70 65 72 |,. s|h or per|
|00002fc0| 6c 2c 20 73 75 63 68 20 | 61 73 20 74 68 65 20 66 |l, such |as the f|
|00002fd0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0d 0d 20 20 20 20 20 |ollowing|:.. |
|00002fe0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 65 | | e|
|00002ff0| 76 61 6c 20 27 28 65 78 | 69 74 20 24 3f 30 29 27 |val '(ex|it $?0)'|
|00003000| 20 26 26 20 65 76 61 6c | 20 27 65 78 65 63 20 2f | && eval| 'exec /|
|00003010| 75 73 72 2f 62 69 6e 2f | 70 65 72 6c 20 2d 53 20 |usr/bin/|perl -S |
|00003020| 24 30 20 24 7b 31 2b 22 | 24 40 22 7d 27 0d 20 20 |$0 ${1+"|$@"}'. |
|00003030| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003040| 20 20 26 20 65 76 61 6c | 20 27 65 78 65 63 20 2f | & eval| 'exec /|
|00003050| 75 73 72 2f 62 69 6e 2f | 70 65 72 6c 20 2d 53 20 |usr/bin/|perl -S |
|00003060| 24 30 20 24 61 72 67 76 | 3a 71 27 0d 20 20 20 20 |$0 $argv|:q'. |
|00003070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003080| 20 20 20 20 20 69 66 20 | 30 3b 0d 0d 0d 2d 75 20 | if |0;...-u |
|00003090| 20 20 63 61 75 73 65 73 | 20 70 65 72 6c 20 74 6f | causes| perl to|
|000030a0| 20 64 75 6d 70 20 63 6f | 72 65 20 61 66 74 65 72 | dump co|re after|
|000030b0| 20 63 6f 6d 70 69 6c 69 | 6e 67 20 79 6f 75 72 20 | compili|ng your |
|000030c0| 73 63 72 69 70 74 2e 20 | 20 59 6f 75 0d 20 20 20 |script. | You. |
|000030d0| 20 20 63 61 6e 20 74 68 | 65 6e 20 74 61 6b 65 20 | can th|en take |
|000030e0| 74 68 69 73 20 63 6f 72 | 65 20 64 75 6d 70 20 61 |this cor|e dump a|
|000030f0| 6e 64 20 74 75 72 6e 20 | 69 74 20 69 6e 74 6f 20 |nd turn |it into |
|00003100| 61 6e 20 65 78 65 63 75 | 74 61 62 6c 65 0d 20 20 |an execu|table. |
|00003110| 20 20 20 66 69 6c 65 20 | 62 79 20 75 73 69 6e 67 | file |by using|
|00003120| 20 74 68 65 20 75 6e 64 | 75 6d 70 20 70 72 6f 67 | the und|ump prog|
|00003130| 72 61 6d 20 28 6e 6f 74 | 20 73 75 70 70 6c 69 65 |ram (not| supplie|
|00003140| 64 29 2e 20 20 54 68 69 | 73 0d 20 20 20 20 20 73 |d). Thi|s. s|
|00003150| 70 65 65 64 73 20 73 74 | 61 72 74 75 70 20 61 74 |peeds st|artup at|
|00003160| 20 74 68 65 20 65 78 70 | 65 6e 73 65 20 6f 66 20 | the exp|ense of |
|00003170| 73 6f 6d 65 20 64 69 73 | 6b 20 73 70 61 63 65 20 |some dis|k space |
|00003180| 28 77 68 69 63 68 20 79 | 6f 75 0d 20 20 20 20 20 |(which y|ou. |
|00003190| 63 61 6e 20 6d 69 6e 69 | 6d 69 7a 65 20 62 79 20 |can mini|mize by |
|000031a0| 73 74 72 69 70 70 69 6e | 67 20 74 68 65 20 65 78 |strippin|g the ex|
|000031b0| 65 63 75 74 61 62 6c 65 | 29 2e 20 20 28 53 74 69 |ecutable|). (Sti|
|000031c0| 6c 6c 2c 20 61 20 22 68 | 65 6c 6c 6f 0d 20 20 20 |ll, a "h|ello. |
|000031d0| 20 20 77 6f 72 6c 64 22 | 20 65 78 65 63 75 74 61 | world"| executa|
|000031e0| 62 6c 65 20 63 6f 6d 65 | 73 20 6f 75 74 20 74 6f |ble come|s out to|
|000031f0| 20 61 62 6f 75 74 20 32 | 30 30 4b 20 6f 6e 20 6d | about 2|00K on m|
|00003200| 79 20 6d 61 63 68 69 6e | 65 2e 29 20 49 66 0d 20 |y machin|e.) If. |
|00003210| 20 20 20 20 79 6f 75 20 | 61 72 65 20 67 6f 69 6e | you |are goin|
|00003220| 67 20 74 6f 20 72 75 6e | 20 79 6f 75 72 20 65 78 |g to run| your ex|
|00003230| 65 63 75 74 61 62 6c 65 | 20 61 73 20 61 20 73 65 |ecutable| as a se|
|00003240| 74 2d 69 64 20 70 72 6f | 67 72 61 6d 0d 20 20 20 |t-id pro|gram. |
|00003250| 20 20 74 68 65 6e 20 79 | 6f 75 20 73 68 6f 75 6c | then y|ou shoul|
|00003260| 64 20 70 72 6f 62 61 62 | 6c 79 20 63 6f 6d 70 69 |d probab|ly compi|
|00003270| 6c 65 20 69 74 20 75 73 | 69 6e 67 20 74 61 69 6e |le it us|ing tain|
|00003280| 74 70 65 72 6c 20 72 61 | 74 68 65 72 0d 20 20 20 |tperl ra|ther. |
|00003290| 20 20 74 68 61 6e 20 6e | 6f 72 6d 61 6c 20 70 65 | than n|ormal pe|
|000032a0| 72 6c 2e 20 20 49 66 20 | 79 6f 75 20 77 61 6e 74 |rl. If |you want|
|000032b0| 20 74 6f 20 65 78 65 63 | 75 74 65 20 61 20 70 6f | to exec|ute a po|
|000032c0| 72 74 69 6f 6e 20 6f 66 | 20 79 6f 75 72 0d 20 20 |rtion of| your. |
|000032d0| 20 20 20 73 63 72 69 70 | 74 20 62 65 66 6f 72 65 | scrip|t before|
|000032e0| 20 64 75 6d 70 69 6e 67 | 2c 20 75 73 65 20 74 68 | dumping|, use th|
|000032f0| 65 20 64 75 6d 70 20 6f | 70 65 72 61 74 6f 72 20 |e dump o|perator |
|00003300| 69 6e 73 74 65 61 64 2e | 20 20 4e 6f 74 65 3a 0d |instead.| Note:.|
|00003310| 20 20 20 20 20 61 76 61 | 69 6c 61 62 69 6c 69 74 | ava|ilabilit|
|00003320| 79 20 6f 66 20 75 6e 64 | 75 6d 70 20 69 73 20 70 |y of und|ump is p|
|00003330| 6c 61 74 66 6f 72 6d 20 | 73 70 65 63 69 66 69 63 |latform |specific|
|00003340| 20 61 6e 64 20 6d 61 79 | 20 6e 6f 74 20 62 65 0d | and may| not be.|
|00003350| 20 20 20 20 20 61 76 61 | 69 6c 61 62 6c 65 20 66 | ava|ilable f|
|00003360| 6f 72 20 61 20 73 70 65 | 63 69 66 69 63 20 70 6f |or a spe|cific po|
|00003370| 72 74 20 6f 66 20 70 65 | 72 6c 2e 0d 0d 2d 55 20 |rt of pe|rl...-U |
|00003380| 20 20 61 6c 6c 6f 77 73 | 20 70 65 72 6c 20 74 6f | allows| perl to|
|00003390| 20 64 6f 20 75 6e 73 61 | 66 65 20 6f 70 65 72 61 | do unsa|fe opera|
|000033a0| 74 69 6f 6e 73 2e 20 20 | 43 75 72 72 65 6e 74 6c |tions. |Currentl|
|000033b0| 79 20 74 68 65 20 6f 6e | 6c 79 0d 20 20 20 20 20 |y the on|ly. |
|000033c0| 22 75 6e 73 61 66 65 22 | 20 6f 70 65 72 61 74 69 |"unsafe"| operati|
|000033d0| 6f 6e 20 69 73 20 74 68 | 65 20 75 6e 6c 69 6e 6b |on is th|e unlink|
|000033e0| 69 6e 67 20 6f 66 20 64 | 69 72 65 63 74 6f 72 69 |ing of d|irectori|
|000033f0| 65 73 20 77 68 69 6c 65 | 0d 20 20 20 20 20 72 75 |es while|. ru|
|00003400| 6e 6e 69 6e 67 20 61 73 | 20 73 75 70 65 72 75 73 |nning as| superus|
|00003410| 65 72 2e 0d 0d 2d 76 20 | 20 20 70 72 69 6e 74 73 |er...-v | prints|
|00003420| 20 74 68 65 20 76 65 72 | 73 69 6f 6e 20 61 6e 64 | the ver|sion and|
|00003430| 20 70 61 74 63 68 6c 65 | 76 65 6c 20 6f 66 20 79 | patchle|vel of y|
|00003440| 6f 75 72 20 70 65 72 6c | 20 65 78 65 63 75 74 61 |our perl| executa|
|00003450| 62 6c 65 2e 0d 0d 2d 77 | 20 20 20 70 72 69 6e 74 |ble...-w| print|
|00003460| 73 20 77 61 72 6e 69 6e | 67 73 20 61 62 6f 75 74 |s warnin|gs about|
|00003470| 20 69 64 65 6e 74 69 66 | 69 65 72 73 20 74 68 61 | identif|iers tha|
|00003480| 74 20 61 72 65 20 6d 65 | 6e 74 69 6f 6e 65 64 20 |t are me|ntioned |
|00003490| 6f 6e 6c 79 0d 20 20 20 | 20 20 6f 6e 63 65 2c 20 |only. | once, |
|000034a0| 61 6e 64 20 73 63 61 6c | 61 72 20 76 61 72 69 61 |and scal|ar varia|
|000034b0| 62 6c 65 73 20 74 68 61 | 74 20 61 72 65 20 75 73 |bles tha|t are us|
|000034c0| 65 64 20 62 65 66 6f 72 | 65 20 62 65 69 6e 67 20 |ed befor|e being |
|000034d0| 73 65 74 2e 0d 20 20 20 | 20 20 41 6c 73 6f 20 77 |set.. | Also w|
|000034e0| 61 72 6e 73 20 61 62 6f | 75 74 20 72 65 64 65 66 |arns abo|ut redef|
|000034f0| 69 6e 65 64 20 73 75 62 | 72 6f 75 74 69 6e 65 73 |ined sub|routines|
|00003500| 2c 20 61 6e 64 20 72 65 | 66 65 72 65 6e 63 65 73 |, and re|ferences|
|00003510| 20 74 6f 0d 20 20 20 20 | 20 75 6e 64 65 66 69 6e | to. | undefin|
|00003520| 65 64 20 66 69 6c 65 68 | 61 6e 64 6c 65 73 20 6f |ed fileh|andles o|
|00003530| 72 20 66 69 6c 65 68 61 | 6e 64 6c 65 73 20 6f 70 |r fileha|ndles op|
|00003540| 65 6e 65 64 20 72 65 61 | 64 6f 6e 6c 79 20 74 68 |ened rea|donly th|
|00003550| 61 74 0d 20 20 20 20 20 | 79 6f 75 20 61 72 65 20 |at. |you are |
|00003560| 61 74 74 65 6d 70 74 69 | 6e 67 20 74 6f 20 77 72 |attempti|ng to wr|
|00003570| 69 74 65 20 6f 6e 2e 20 | 20 41 6c 73 6f 20 77 61 |ite on. | Also wa|
|00003580| 72 6e 73 20 79 6f 75 20 | 69 66 20 79 6f 75 20 75 |rns you |if you u|
|00003590| 73 65 0d 20 20 20 20 20 | 3d 3d 20 6f 6e 20 76 61 |se. |== on va|
|000035a0| 6c 75 65 73 20 74 68 61 | 74 20 64 6f 6e 27 74 20 |lues tha|t don't |
|000035b0| 6c 6f 6f 6b 20 6c 69 6b | 65 20 6e 75 6d 62 65 72 |look lik|e number|
|000035c0| 73 2c 20 61 6e 64 20 69 | 66 20 79 6f 75 72 20 73 |s, and i|f your s|
|000035d0| 75 62 2d 0d 20 20 20 20 | 20 72 6f 75 74 69 6e 65 |ub-. | routine|
|000035e0| 73 20 72 65 63 75 72 73 | 65 20 6d 6f 72 65 20 74 |s recurs|e more t|
|000035f0| 68 61 6e 20 31 30 30 20 | 64 65 65 70 2e 0d 0d 2d |han 100 |deep...-|
|00003600| 78 64 69 72 65 63 74 6f | 72 79 0d 20 20 20 20 20 |xdirecto|ry. |
|00003610| 74 65 6c 6c 73 20 70 65 | 72 6c 20 74 68 61 74 20 |tells pe|rl that |
|00003620| 74 68 65 20 73 63 72 69 | 70 74 20 69 73 20 65 6d |the scri|pt is em|
|00003630| 62 65 64 64 65 64 20 69 | 6e 20 61 20 6d 65 73 73 |bedded i|n a mess|
|00003640| 61 67 65 2e 20 20 4c 65 | 61 64 2d 0d 20 20 20 20 |age. Le|ad-. |
|00003650| 20 69 6e 67 20 67 61 72 | 62 61 67 65 20 77 69 6c | ing gar|bage wil|
|00003660| 6c 20 62 65 20 64 69 73 | 63 61 72 64 65 64 20 75 |l be dis|carded u|
|00003670| 6e 74 69 6c 20 74 68 65 | 20 66 69 72 73 74 20 6c |ntil the| first l|
|00003680| 69 6e 65 20 74 68 61 74 | 0d 20 20 20 20 20 73 74 |ine that|. st|
|00003690| 61 72 74 73 20 77 69 74 | 68 20 23 21 20 61 6e 64 |arts wit|h #! and|
|000036a0| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 73 74 | contain|s the st|
|000036b0| 72 69 6e 67 20 22 70 65 | 72 6c 22 2e 20 20 41 6e |ring "pe|rl". An|
|000036c0| 79 20 6d 65 61 6e 69 6e | 67 2d 0d 20 20 20 20 20 |y meanin|g-. |
|000036d0| 66 75 6c 20 73 77 69 74 | 63 68 65 73 20 6f 6e 20 |ful swit|ches on |
|000036e0| 74 68 61 74 20 6c 69 6e | 65 20 77 69 6c 6c 20 62 |that lin|e will b|
|000036f0| 65 20 61 70 70 6c 69 65 | 64 20 28 62 75 74 20 6f |e applie|d (but o|
|00003700| 6e 6c 79 20 6f 6e 65 0d | 20 20 20 20 20 67 72 6f |nly one.| gro|
|00003710| 75 70 20 6f 66 20 73 77 | 69 74 63 68 65 73 2c 20 |up of sw|itches, |
|00003720| 61 73 20 77 69 74 68 20 | 6e 6f 72 6d 61 6c 20 23 |as with |normal #|
|00003730| 21 20 70 72 6f 63 65 73 | 73 69 6e 67 29 2e 20 20 |! proces|sing). |
|00003740| 49 66 20 61 0d 20 20 20 | 20 20 64 69 72 65 63 74 |If a. | direct|
|00003750| 6f 72 79 20 6e 61 6d 65 | 20 69 73 20 73 70 65 63 |ory name| is spec|
|00003760| 69 66 69 65 64 2c 20 50 | 65 72 6c 20 77 69 6c 6c |ified, P|erl will|
|00003770| 20 73 77 69 74 63 68 20 | 74 6f 20 74 68 61 74 20 | switch |to that |
|00003780| 64 69 72 65 63 2d 0d 20 | 20 20 20 20 74 6f 72 79 |direc-. | tory|
|00003790| 20 62 65 66 6f 72 65 20 | 72 75 6e 6e 69 6e 67 20 | before |running |
|000037a0| 74 68 65 20 73 63 72 69 | 70 74 2e 20 20 54 68 65 |the scri|pt. The|
|000037b0| 20 2d 78 20 73 77 69 74 | 63 68 20 6f 6e 6c 79 20 | -x swit|ch only |
|000037c0| 63 6f 6e 74 72 6f 6c 73 | 0d 20 20 20 20 20 74 68 |controls|. th|
|000037d0| 65 20 74 68 65 20 64 69 | 73 70 6f 73 61 6c 20 6f |e the di|sposal o|
|000037e0| 66 20 6c 65 61 64 69 6e | 67 20 67 61 72 62 61 67 |f leadin|g garbag|
|000037f0| 65 2e 20 20 54 68 65 20 | 73 63 72 69 70 74 20 6d |e. The |script m|
|00003800| 75 73 74 20 62 65 0d 20 | 20 20 20 20 74 65 72 6d |ust be. | term|
|00003810| 69 6e 61 74 65 64 20 77 | 69 74 68 20 5f 5f 45 4e |inated w|ith __EN|
|00003820| 44 5f 5f 20 69 66 20 74 | 68 65 72 65 20 69 73 20 |D__ if t|here is |
|00003830| 74 72 61 69 6c 69 6e 67 | 20 67 61 72 62 61 67 65 |trailing| garbage|
|00003840| 20 74 6f 20 62 65 0d 20 | 20 20 20 20 69 67 6e 6f | to be. | igno|
|00003850| 72 65 64 20 28 74 68 65 | 20 73 63 72 69 70 74 20 |red (the| script |
|00003860| 63 61 6e 20 70 72 6f 63 | 65 73 73 20 61 6e 79 20 |can proc|ess any |
|00003870| 6f 72 20 61 6c 6c 20 6f | 66 20 74 68 65 20 74 72 |or all o|f the tr|
|00003880| 61 69 6c 69 6e 67 0d 20 | 20 20 20 20 67 61 72 62 |ailing. | garb|
|00003890| 61 67 65 20 76 69 61 20 | 74 68 65 20 44 41 54 41 |age via |the DATA|
|000038a0| 20 66 69 6c 65 68 61 6e | 64 6c 65 20 69 66 20 64 | filehan|dle if d|
|000038b0| 65 73 69 72 65 64 29 2e | 0d be 4b 59 20 50 65 72 |esired).|..KY Per|
|000038c0| 6c c9 54 79 70 65 73 0d | be 43 0d 50 65 72 6c 20 |l.Types.|.C.Perl |
|000038d0| 68 61 73 20 74 68 72 65 | 65 20 64 61 74 61 20 74 |has thre|e data t|
|000038e0| 79 70 65 73 3a 20 73 63 | 61 6c 61 72 73 2c 20 61 |ypes: sc|alars, a|
|000038f0| 72 72 61 79 73 20 6f 66 | 20 73 63 61 6c 61 72 73 |rrays of| scalars|
|00003900| 2c 20 61 6e 64 20 61 73 | 73 6f 2d 0d 63 69 61 74 |, and as|so-.ciat|
|00003910| 69 76 65 20 61 72 72 61 | 79 73 20 6f 66 20 73 63 |ive arra|ys of sc|
|00003920| 61 6c 61 72 73 2e 20 20 | 4e 6f 72 6d 61 6c 20 61 |alars. |Normal a|
|00003930| 72 72 61 79 73 20 61 72 | 65 20 69 6e 64 65 78 65 |rrays ar|e indexe|
|00003940| 64 20 62 79 20 6e 75 6d | 62 65 72 2c 0d 61 6e 64 |d by num|ber,.and|
|00003950| 20 61 73 73 6f 63 69 61 | 74 69 76 65 20 61 72 72 | associa|tive arr|
|00003960| 61 79 73 20 62 79 20 73 | 74 72 69 6e 67 2e 0d 0d |ays by s|tring...|
|00003970| 54 68 65 20 69 6e 74 65 | 72 70 72 65 74 61 74 69 |The inte|rpretati|
|00003980| 6f 6e 20 6f 66 20 6f 70 | 65 72 61 74 69 6f 6e 73 |on of op|erations|
|00003990| 20 61 6e 64 20 76 61 6c | 75 65 73 20 69 6e 20 70 | and val|ues in p|
|000039a0| 65 72 6c 20 73 6f 6d 65 | 74 69 6d 65 73 0d 64 65 |erl some|times.de|
|000039b0| 70 65 6e 64 73 20 6f 6e | 20 74 68 65 20 72 65 71 |pends on| the req|
|000039c0| 75 69 72 65 6d 65 6e 74 | 73 20 6f 66 20 74 68 65 |uirement|s of the|
|000039d0| 20 63 6f 6e 74 65 78 74 | 20 61 72 6f 75 6e 64 20 | context| around |
|000039e0| 74 68 65 20 6f 70 65 72 | 61 74 69 6f 6e 0d 6f 72 |the oper|ation.or|
|000039f0| 20 76 61 6c 75 65 2e 20 | 20 54 68 65 72 65 20 61 | value. | There a|
|00003a00| 72 65 20 74 68 72 65 65 | 20 6d 61 6a 6f 72 20 63 |re three| major c|
|00003a10| 6f 6e 74 65 78 74 73 3a | 20 73 74 72 69 6e 67 2c |ontexts:| string,|
|00003a20| 20 6e 75 6d 65 72 69 63 | 20 61 6e 64 0d 61 72 72 | numeric| and.arr|
|00003a30| 61 79 2e 20 20 43 65 72 | 74 61 69 6e 20 6f 70 65 |ay. Cer|tain ope|
|00003a40| 72 61 74 69 6f 6e 73 20 | 72 65 74 75 72 6e 20 61 |rations |return a|
|00003a50| 72 72 61 79 20 76 61 6c | 75 65 73 20 69 6e 20 63 |rray val|ues in c|
|00003a60| 6f 6e 74 65 78 74 73 20 | 77 61 6e 74 2d 0d 69 6e |ontexts |want-.in|
|00003a70| 67 20 61 6e 20 61 72 72 | 61 79 2c 20 61 6e 64 20 |g an arr|ay, and |
|00003a80| 73 63 61 6c 61 72 20 76 | 61 6c 75 65 73 20 6f 74 |scalar v|alues ot|
|00003a90| 68 65 72 77 69 73 65 2e | 20 20 28 49 66 20 74 68 |herwise.| (If th|
|00003aa0| 69 73 20 69 73 20 74 72 | 75 65 20 6f 66 0d 61 6e |is is tr|ue of.an|
|00003ab0| 20 6f 70 65 72 61 74 69 | 6f 6e 20 69 74 20 77 69 | operati|on it wi|
|00003ac0| 6c 6c 20 62 65 20 6d 65 | 6e 74 69 6f 6e 65 64 20 |ll be me|ntioned |
|00003ad0| 69 6e 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 61 |in the d|ocumenta|
|00003ae0| 74 69 6f 6e 20 66 6f 72 | 20 74 68 61 74 0d 6f 70 |tion for| that.op|
|00003af0| 65 72 61 74 69 6f 6e 2e | 29 20 4f 70 65 72 61 74 |eration.|) Operat|
|00003b00| 69 6f 6e 73 20 77 68 69 | 63 68 20 72 65 74 75 72 |ions whi|ch retur|
|00003b10| 6e 20 73 63 61 6c 61 72 | 73 20 64 6f 6e 27 74 20 |n scalar|s don't |
|00003b20| 63 61 72 65 20 77 68 65 | 74 68 65 72 0d 74 68 65 |care whe|ther.the|
|00003b30| 20 63 6f 6e 74 65 78 74 | 20 69 73 20 6c 6f 6f 6b | context| is look|
|00003b40| 69 6e 67 20 66 6f 72 20 | 61 20 73 74 72 69 6e 67 |ing for |a string|
|00003b50| 20 6f 72 20 61 20 6e 75 | 6d 62 65 72 2c 20 62 75 | or a nu|mber, bu|
|00003b60| 74 20 73 63 61 6c 61 72 | 20 76 61 72 69 2d 0d 61 |t scalar| vari-.a|
|00003b70| 62 6c 65 73 20 61 6e 64 | 20 76 61 6c 75 65 73 20 |bles and| values |
|00003b80| 61 72 65 20 69 6e 74 65 | 72 70 72 65 74 65 64 20 |are inte|rpreted |
|00003b90| 61 73 20 73 74 72 69 6e | 67 73 20 6f 72 20 6e 75 |as strin|gs or nu|
|00003ba0| 6d 62 65 72 73 20 61 73 | 0d 61 70 70 72 6f 70 72 |mbers as|.appropr|
|00003bb0| 69 61 74 65 20 74 6f 20 | 74 68 65 20 63 6f 6e 74 |iate to |the cont|
|00003bc0| 65 78 74 2e 20 20 41 20 | 73 63 61 6c 61 72 20 69 |ext. A |scalar i|
|00003bd0| 73 20 69 6e 74 65 72 70 | 72 65 74 65 64 20 61 73 |s interp|reted as|
|00003be0| 20 54 52 55 45 20 69 6e | 0d 74 68 65 20 62 6f 6f | TRUE in|.the boo|
|00003bf0| 6c 65 61 6e 20 73 65 6e | 73 65 20 69 66 20 69 74 |lean sen|se if it|
|00003c00| 20 69 73 20 6e 6f 74 20 | 74 68 65 20 6e 75 6c 6c | is not |the null|
|00003c10| 20 73 74 72 69 6e 67 20 | 6f 72 20 30 2e 20 20 42 | string |or 0. B|
|00003c20| 6f 6f 6c 65 61 6e 73 0d | 72 65 74 75 72 6e 65 64 |ooleans.|returned|
|00003c30| 20 62 79 20 6f 70 65 72 | 61 74 6f 72 73 20 61 72 | by oper|ators ar|
|00003c40| 65 20 31 20 66 6f 72 20 | 74 72 75 65 20 61 6e 64 |e 1 for |true and|
|00003c50| 20 30 20 6f 72 20 27 27 | 20 28 74 68 65 20 6e 75 | 0 or ''| (the nu|
|00003c60| 6c 6c 0d 73 74 72 69 6e | 67 29 20 66 6f 72 20 66 |ll.strin|g) for f|
|00003c70| 61 6c 73 65 2e 0d 0d 54 | 68 65 72 65 20 61 72 65 |alse...T|here are|
|00003c80| 20 61 63 74 75 61 6c 6c | 79 20 74 77 6f 20 76 61 | actuall|y two va|
|00003c90| 72 69 65 74 69 65 73 20 | 6f 66 20 6e 75 6c 6c 20 |rieties |of null |
|00003ca0| 73 74 72 69 6e 67 3a 20 | 64 65 66 69 6e 65 64 20 |string: |defined |
|00003cb0| 61 6e 64 0d 75 6e 64 65 | 66 69 6e 65 64 2e 20 20 |and.unde|fined. |
|00003cc0| 55 6e 64 65 66 69 6e 65 | 64 20 6e 75 6c 6c 20 73 |Undefine|d null s|
|00003cd0| 74 72 69 6e 67 73 20 61 | 72 65 20 72 65 74 75 72 |trings a|re retur|
|00003ce0| 6e 65 64 20 77 68 65 6e | 20 74 68 65 72 65 20 69 |ned when| there i|
|00003cf0| 73 20 6e 6f 0d 72 65 61 | 6c 20 76 61 6c 75 65 20 |s no.rea|l value |
|00003d00| 66 6f 72 20 73 6f 6d 65 | 74 68 69 6e 67 2c 20 73 |for some|thing, s|
|00003d10| 75 63 68 20 61 73 20 77 | 68 65 6e 20 74 68 65 72 |uch as w|hen ther|
|00003d20| 65 20 77 61 73 20 61 6e | 20 65 72 72 6f 72 2c 20 |e was an| error, |
|00003d30| 6f 72 20 61 74 0d 65 6e | 64 20 6f 66 20 66 69 6c |or at.en|d of fil|
|00003d40| 65 2c 20 6f 72 20 77 68 | 65 6e 20 79 6f 75 20 72 |e, or wh|en you r|
|00003d50| 65 66 65 72 20 74 6f 20 | 61 6e 20 75 6e 69 6e 69 |efer to |an unini|
|00003d60| 74 69 61 6c 69 7a 65 64 | 20 76 61 72 69 61 62 6c |tialized| variabl|
|00003d70| 65 20 6f 72 0d 65 6c 65 | 6d 65 6e 74 20 6f 66 20 |e or.ele|ment of |
|00003d80| 61 6e 20 61 72 72 61 79 | 2e 20 20 41 6e 20 75 6e |an array|. An un|
|00003d90| 64 65 66 69 6e 65 64 20 | 6e 75 6c 6c 20 73 74 72 |defined |null str|
|00003da0| 69 6e 67 20 6d 61 79 20 | 62 65 63 6f 6d 65 20 64 |ing may |become d|
|00003db0| 65 66 69 6e 65 64 0d 74 | 68 65 20 66 69 72 73 74 |efined.t|he first|
|00003dc0| 20 74 69 6d 65 20 79 6f | 75 20 61 63 63 65 73 73 | time yo|u access|
|00003dd0| 20 69 74 2c 20 62 75 74 | 20 70 72 69 6f 72 20 74 | it, but| prior t|
|00003de0| 6f 20 74 68 61 74 20 79 | 6f 75 20 63 61 6e 20 75 |o that y|ou can u|
|00003df0| 73 65 20 74 68 65 0d 64 | 65 66 69 6e 65 64 28 29 |se the.d|efined()|
|00003e00| 20 6f 70 65 72 61 74 6f | 72 20 74 6f 20 64 65 74 | operato|r to det|
|00003e10| 65 72 6d 69 6e 65 20 77 | 68 65 74 68 65 72 20 74 |ermine w|hether t|
|00003e20| 68 65 20 76 61 6c 75 65 | 20 69 73 20 64 65 66 69 |he value| is defi|
|00003e30| 6e 65 64 20 6f 72 0d 6e | 6f 74 2e 0d 0d 52 65 66 |ned or.n|ot...Ref|
|00003e40| 65 72 65 6e 63 65 73 20 | 74 6f 20 73 63 61 6c 61 |erences |to scala|
|00003e50| 72 20 76 61 72 69 61 62 | 6c 65 73 20 61 6c 77 61 |r variab|les alwa|
|00003e60| 79 73 20 62 65 67 69 6e | 20 77 69 74 68 20 27 24 |ys begin| with '$|
|00003e70| 27 2c 20 65 76 65 6e 20 | 77 68 65 6e 0d 72 65 66 |', even |when.ref|
|00003e80| 65 72 72 69 6e 67 20 74 | 6f 20 61 20 73 63 61 6c |erring t|o a scal|
|00003e90| 61 72 20 74 68 61 74 20 | 69 73 20 70 61 72 74 20 |ar that |is part |
|00003ea0| 6f 66 20 61 6e 20 61 72 | 72 61 79 2e 20 20 54 68 |of an ar|ray. Th|
|00003eb0| 75 73 3a 0d 0d 20 20 20 | 20 20 20 20 20 20 20 24 |us:.. | $|
|00003ec0| 64 61 79 73 20 20 20 20 | 20 20 20 20 20 20 20 23 |days | #|
|00003ed0| 20 61 20 73 69 6d 70 6c | 65 20 73 63 61 6c 61 72 | a simpl|e scalar|
|00003ee0| 20 76 61 72 69 61 62 6c | 65 0d 20 20 20 20 20 20 | variabl|e. |
|00003ef0| 20 20 20 20 24 64 61 79 | 73 5b 32 38 5d 20 20 20 | $day|s[28] |
|00003f00| 20 20 20 20 23 20 32 39 | 74 68 20 65 6c 65 6d 65 | # 29|th eleme|
|00003f10| 6e 74 20 6f 66 20 61 72 | 72 61 79 20 40 64 61 79 |nt of ar|ray @day|
|00003f20| 73 0d 20 20 20 20 20 20 | 20 20 20 20 24 64 61 79 |s. | $day|
|00003f30| 73 7b 27 46 65 62 27 7d | 20 20 20 20 23 20 6f 6e |s{'Feb'}| # on|
|00003f40| 65 20 76 61 6c 75 65 20 | 66 72 6f 6d 20 61 6e 20 |e value |from an |
|00003f50| 61 73 73 6f 63 69 61 74 | 69 76 65 20 61 72 72 61 |associat|ive arra|
|00003f60| 79 0d 20 20 20 20 20 20 | 20 20 20 20 24 23 64 61 |y. | $#da|
|00003f70| 79 73 20 20 20 20 20 20 | 20 20 20 20 23 20 6c 61 |ys | # la|
|00003f80| 73 74 20 69 6e 64 65 78 | 20 6f 66 20 61 72 72 61 |st index| of arra|
|00003f90| 79 20 40 64 61 79 73 0d | 0d 62 75 74 20 65 6e 74 |y @days.|.but ent|
|00003fa0| 69 72 65 20 61 72 72 61 | 79 73 20 6f 72 20 61 72 |ire arra|ys or ar|
|00003fb0| 72 61 79 20 73 6c 69 63 | 65 73 20 61 72 65 20 64 |ray slic|es are d|
|00003fc0| 65 6e 6f 74 65 64 20 62 | 79 20 27 40 27 3a 0d 0d |enoted b|y '@':..|
|00003fd0| 20 20 20 20 20 20 20 20 | 20 20 40 64 61 79 73 20 | | @days |
|00003fe0| 20 20 20 20 20 20 20 20 | 20 20 23 20 28 24 64 61 | | # ($da|
|00003ff0| 79 73 5b 30 5d 2c 20 24 | 64 61 79 73 5b 31 5d 2c |ys[0], $|days[1],|
|00004000| 2e 2e 2e 20 24 64 61 79 | 73 5b 6e 5d 29 0d 20 20 |... $day|s[n]). |
|00004010| 20 20 20 20 20 20 20 20 | 40 64 61 79 73 5b 33 2c | |@days[3,|
|00004020| 34 2c 35 5d 20 20 20 20 | 23 20 73 61 6d 65 20 61 |4,5] |# same a|
|00004030| 73 20 40 64 61 79 73 5b | 33 2e 2e 35 5d 0d 20 20 |s @days[|3..5]. |
|00004040| 20 20 20 20 20 20 20 20 | 40 64 61 79 73 7b 27 61 | |@days{'a|
|00004050| 27 2c 27 63 27 7d 20 20 | 23 20 73 61 6d 65 20 61 |','c'} |# same a|
|00004060| 73 20 28 24 64 61 79 73 | 7b 27 61 27 7d 2c 24 64 |s ($days|{'a'},$d|
|00004070| 61 79 73 7b 27 63 27 7d | 29 0d 0d 61 6e 64 20 65 |ays{'c'}|)..and e|
|00004080| 6e 74 69 72 65 20 61 73 | 73 6f 63 69 61 74 69 76 |ntire as|sociativ|
|00004090| 65 20 61 72 72 61 79 73 | 20 61 72 65 20 64 65 6e |e arrays| are den|
|000040a0| 6f 74 65 64 20 62 79 20 | 27 25 27 3a 0d 0d 20 20 |oted by |'%':.. |
|000040b0| 20 20 20 20 20 20 20 20 | 25 64 61 79 73 20 20 20 | |%days |
|000040c0| 20 20 20 20 20 20 20 20 | 23 20 28 6b 65 79 31 2c | |# (key1,|
|000040d0| 20 76 61 6c 31 2c 20 6b | 65 79 32 2c 20 76 61 6c | val1, k|ey2, val|
|000040e0| 32 20 2e 2e 2e 29 0d 0d | 41 6e 79 20 6f 66 20 74 |2 ...)..|Any of t|
|000040f0| 68 65 73 65 20 65 69 67 | 68 74 20 63 6f 6e 73 74 |hese eig|ht const|
|00004100| 72 75 63 74 73 20 6d 61 | 79 20 73 65 72 76 65 20 |ructs ma|y serve |
|00004110| 61 73 20 61 6e 20 6c 76 | 61 6c 75 65 2c 20 74 68 |as an lv|alue, th|
|00004120| 61 74 20 69 73 2c 0d 6d | 61 79 20 62 65 20 61 73 |at is,.m|ay be as|
|00004130| 73 69 67 6e 65 64 20 74 | 6f 2e 20 20 28 49 74 20 |signed t|o. (It |
|00004140| 61 6c 73 6f 20 74 75 72 | 6e 73 20 6f 75 74 20 74 |also tur|ns out t|
|00004150| 68 61 74 20 61 6e 20 61 | 73 73 69 67 6e 6d 65 6e |hat an a|ssignmen|
|00004160| 74 20 69 73 0d 69 74 73 | 65 6c 66 20 61 6e 20 6c |t is.its|elf an l|
|00004170| 76 61 6c 75 65 20 69 6e | 20 63 65 72 74 61 69 6e |value in| certain|
|00004180| 20 63 6f 6e 74 65 78 74 | 73 2d 2d 73 65 65 20 65 | context|s--see e|
|00004190| 78 61 6d 70 6c 65 73 20 | 75 6e 64 65 72 20 73 2c |xamples |under s,|
|000041a0| 20 74 72 0d 61 6e 64 20 | 63 68 6f 70 2e 29 20 41 | tr.and |chop.) A|
|000041b0| 73 73 69 67 6e 6d 65 6e | 74 20 74 6f 20 61 20 73 |ssignmen|t to a s|
|000041c0| 63 61 6c 61 72 20 65 76 | 61 6c 75 61 74 65 73 20 |calar ev|aluates |
|000041d0| 74 68 65 20 72 69 67 68 | 74 68 61 6e 64 20 73 69 |the righ|thand si|
|000041e0| 64 65 20 69 6e 0d 61 20 | 73 63 61 6c 61 72 20 63 |de in.a |scalar c|
|000041f0| 6f 6e 74 65 78 74 2c 20 | 77 68 69 6c 65 20 61 73 |ontext, |while as|
|00004200| 73 69 67 6e 6d 65 6e 74 | 20 74 6f 20 61 6e 20 61 |signment| to an a|
|00004210| 72 72 61 79 20 6f 72 20 | 61 72 72 61 79 20 73 6c |rray or |array sl|
|00004220| 69 63 65 0d 65 76 61 6c | 75 61 74 65 73 20 74 68 |ice.eval|uates th|
|00004230| 65 20 72 69 67 68 74 68 | 61 6e 64 20 73 69 64 65 |e righth|and side|
|00004240| 20 69 6e 20 61 6e 20 61 | 72 72 61 79 20 63 6f 6e | in an a|rray con|
|00004250| 74 65 78 74 2e 0d 0d 59 | 6f 75 20 6d 61 79 20 66 |text...Y|ou may f|
|00004260| 69 6e 64 20 74 68 65 20 | 6c 65 6e 67 74 68 20 6f |ind the |length o|
|00004270| 66 20 61 72 72 61 79 20 | 40 64 61 79 73 20 62 79 |f array |@days by|
|00004280| 20 65 76 61 6c 75 61 74 | 69 6e 67 20 22 24 23 64 | evaluat|ing "$#d|
|00004290| 61 79 73 22 2c 20 61 73 | 0d 69 6e 20 63 73 68 2e |ays", as|.in csh.|
|000042a0| 20 20 28 41 63 74 75 61 | 6c 6c 79 2c 20 69 74 27 | (Actua|lly, it'|
|000042b0| 73 20 6e 6f 74 20 74 68 | 65 20 6c 65 6e 67 74 68 |s not th|e length|
|000042c0| 20 6f 66 20 74 68 65 20 | 61 72 72 61 79 2c 20 69 | of the |array, i|
|000042d0| 74 27 73 20 74 68 65 0d | 73 75 62 73 63 72 69 70 |t's the.|subscrip|
|000042e0| 74 20 6f 66 20 74 68 65 | 20 6c 61 73 74 20 65 6c |t of the| last el|
|000042f0| 65 6d 65 6e 74 2c 20 73 | 69 6e 63 65 20 74 68 65 |ement, s|ince the|
|00004300| 72 65 20 69 73 20 28 6f | 72 64 69 6e 61 72 69 6c |re is (o|rdinaril|
|00004310| 79 29 20 61 20 30 74 68 | 0d 65 6c 65 6d 65 6e 74 |y) a 0th|.element|
|00004320| 2e 29 20 41 73 73 69 67 | 6e 69 6e 67 20 74 6f 20 |.) Assig|ning to |
|00004330| 24 23 64 61 79 73 20 63 | 68 61 6e 67 65 73 20 74 |$#days c|hanges t|
|00004340| 68 65 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 68 65 |he lengt|h of the|
|00004350| 20 61 72 72 61 79 2e 0d | 53 68 6f 72 74 65 6e 69 | array..|Shorteni|
|00004360| 6e 67 20 61 6e 20 61 72 | 72 61 79 20 62 79 20 74 |ng an ar|ray by t|
|00004370| 68 69 73 20 6d 65 74 68 | 6f 64 20 64 6f 65 73 20 |his meth|od does |
|00004380| 6e 6f 74 20 61 63 74 75 | 61 6c 6c 79 20 64 65 73 |not actu|ally des|
|00004390| 74 72 6f 79 20 61 6e 79 | 0d 76 61 6c 75 65 73 2e |troy any|.values.|
|000043a0| 20 20 4c 65 6e 67 74 68 | 65 6e 69 6e 67 20 61 6e | Length|ening an|
|000043b0| 20 61 72 72 61 79 20 74 | 68 61 74 20 77 61 73 20 | array t|hat was |
|000043c0| 70 72 65 76 69 6f 75 73 | 6c 79 20 73 68 6f 72 74 |previous|ly short|
|000043d0| 65 6e 65 64 0d 72 65 63 | 6f 76 65 72 73 20 74 68 |ened.rec|overs th|
|000043e0| 65 20 76 61 6c 75 65 73 | 20 74 68 61 74 20 77 65 |e values| that we|
|000043f0| 72 65 20 69 6e 20 74 68 | 6f 73 65 20 65 6c 65 6d |re in th|ose elem|
|00004400| 65 6e 74 73 2e 20 20 59 | 6f 75 20 63 61 6e 20 61 |ents. Y|ou can a|
|00004410| 6c 73 6f 0d 67 61 69 6e | 20 73 6f 6d 65 20 6d 65 |lso.gain| some me|
|00004420| 61 73 75 72 65 20 6f 66 | 20 65 66 66 69 63 69 65 |asure of| efficie|
|00004430| 6e 63 79 20 62 79 20 70 | 72 65 65 78 74 65 6e 64 |ncy by p|reextend|
|00004440| 69 6e 67 20 61 6e 20 61 | 72 72 61 79 20 74 68 61 |ing an a|rray tha|
|00004450| 74 20 69 73 0d 67 6f 69 | 6e 67 20 74 6f 20 67 65 |t is.goi|ng to ge|
|00004460| 74 20 62 69 67 2e 20 20 | 28 59 6f 75 20 63 61 6e |t big. |(You can|
|00004470| 20 61 6c 73 6f 20 65 78 | 74 65 6e 64 20 61 6e 20 | also ex|tend an |
|00004480| 61 72 72 61 79 20 62 79 | 20 61 73 73 69 67 6e 69 |array by| assigni|
|00004490| 6e 67 20 74 6f 0d 61 6e | 20 65 6c 65 6d 65 6e 74 |ng to.an| element|
|000044a0| 20 74 68 61 74 20 69 73 | 20 6f 66 66 20 74 68 65 | that is| off the|
|000044b0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 61 72 72 61 | end of |the arra|
|000044c0| 79 2e 20 20 54 68 69 73 | 20 64 69 66 66 65 72 73 |y. This| differs|
|000044d0| 20 66 72 6f 6d 0d 61 73 | 73 69 67 6e 69 6e 67 20 | from.as|signing |
|000044e0| 74 6f 20 24 23 77 68 61 | 74 65 76 65 72 20 69 6e |to $#wha|tever in|
|000044f0| 20 74 68 61 74 20 69 6e | 74 65 72 76 65 6e 69 6e | that in|tervenin|
|00004500| 67 20 76 61 6c 75 65 73 | 20 61 72 65 20 73 65 74 |g values| are set|
|00004510| 20 74 6f 0d 6e 75 6c 6c | 20 72 61 74 68 65 72 20 | to.null| rather |
|00004520| 74 68 61 6e 20 72 65 63 | 6f 76 65 72 65 64 2e 29 |than rec|overed.)|
|00004530| 20 59 6f 75 20 63 61 6e | 20 74 72 75 6e 63 61 74 | You can| truncat|
|00004540| 65 20 61 6e 20 61 72 72 | 61 79 20 64 6f 77 6e 20 |e an arr|ay down |
|00004550| 74 6f 0d 6e 6f 74 68 69 | 6e 67 20 62 79 20 61 73 |to.nothi|ng by as|
|00004560| 73 69 67 6e 69 6e 67 20 | 74 68 65 20 6e 75 6c 6c |signing |the null|
|00004570| 20 6c 69 73 74 20 28 29 | 20 74 6f 20 69 74 2e 20 | list ()| to it. |
|00004580| 20 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 61 | The fol|lowing a|
|00004590| 72 65 0d 65 78 61 63 74 | 6c 79 20 65 71 75 69 76 |re.exact|ly equiv|
|000045a0| 61 6c 65 6e 74 0d 0d 20 | 20 20 20 20 40 77 68 61 |alent.. | @wha|
|000045b0| 74 65 76 65 72 20 3d 20 | 28 29 3b 0d 20 20 20 20 |tever = |();. |
|000045c0| 20 24 23 77 68 61 74 65 | 76 65 72 20 3d 20 24 5b | $#whate|ver = $[|
|000045d0| 20 2d 20 31 3b 0d 0d 0d | 49 66 20 79 6f 75 20 65 | - 1;...|If you e|
|000045e0| 76 61 6c 75 61 74 65 20 | 61 6e 20 61 72 72 61 79 |valuate |an array|
|000045f0| 20 69 6e 20 61 20 73 63 | 61 6c 61 72 20 63 6f 6e | in a sc|alar con|
|00004600| 74 65 78 74 2c 20 69 74 | 20 72 65 74 75 72 6e 73 |text, it| returns|
|00004610| 20 74 68 65 0d 6c 65 6e | 67 74 68 20 6f 66 20 74 | the.len|gth of t|
|00004620| 68 65 20 61 72 72 61 79 | 2e 20 20 54 68 65 20 66 |he array|. The f|
|00004630| 6f 6c 6c 6f 77 69 6e 67 | 20 69 73 20 61 6c 77 61 |ollowing| is alwa|
|00004640| 79 73 20 74 72 75 65 3a | 0d 0d 20 20 20 20 20 73 |ys true:|.. s|
|00004650| 63 61 6c 61 72 28 40 77 | 68 61 74 65 76 65 72 29 |calar(@w|hatever)|
|00004660| 20 3d 3d 20 24 23 77 68 | 61 74 65 76 65 72 20 2d | == $#wh|atever -|
|00004670| 20 24 5b 20 2b 20 31 3b | 0d 0d 49 66 20 79 6f 75 | $[ + 1;|..If you|
|00004680| 20 65 76 61 6c 75 61 74 | 65 20 61 6e 20 61 73 73 | evaluat|e an ass|
|00004690| 6f 63 69 61 74 69 76 65 | 20 61 72 72 61 79 20 69 |ociative| array i|
|000046a0| 6e 20 61 20 73 63 61 6c | 61 72 20 63 6f 6e 74 65 |n a scal|ar conte|
|000046b0| 78 74 2c 20 69 74 20 72 | 65 74 75 72 6e 73 0d 61 |xt, it r|eturns.a|
|000046c0| 20 76 61 6c 75 65 20 77 | 68 69 63 68 20 69 73 20 | value w|hich is |
|000046d0| 74 72 75 65 20 69 66 20 | 61 6e 64 20 6f 6e 6c 79 |true if |and only|
|000046e0| 20 69 66 20 74 68 65 20 | 61 72 72 61 79 20 63 6f | if the |array co|
|000046f0| 6e 74 61 69 6e 73 20 61 | 6e 79 20 65 6c 65 6d 65 |ntains a|ny eleme|
|00004700| 6e 74 73 2e 0d 28 49 66 | 20 74 68 65 72 65 20 61 |nts..(If| there a|
|00004710| 72 65 20 61 6e 79 20 65 | 6c 65 6d 65 6e 74 73 2c |re any e|lements,|
|00004720| 20 74 68 65 20 76 61 6c | 75 65 20 72 65 74 75 72 | the val|ue retur|
|00004730| 6e 65 64 20 69 73 20 61 | 20 73 74 72 69 6e 67 20 |ned is a| string |
|00004740| 63 6f 6e 73 69 73 74 69 | 6e 67 0d 6f 66 20 74 68 |consisti|ng.of th|
|00004750| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 75 73 65 64 |e number| of used|
|00004760| 20 62 75 63 6b 65 74 73 | 20 61 6e 64 20 74 68 65 | buckets| and the|
|00004770| 20 6e 75 6d 62 65 72 20 | 6f 66 20 61 6c 6c 6f 63 | number |of alloc|
|00004780| 61 74 65 64 20 62 75 63 | 6b 65 74 73 2c 0d 73 65 |ated buc|kets,.se|
|00004790| 70 61 72 61 74 65 64 20 | 62 79 20 61 20 73 6c 61 |parated |by a sla|
|000047a0| 73 68 2e 29 0d 0d 4d 75 | 6c 74 69 2d 64 69 6d 65 |sh.)..Mu|lti-dime|
|000047b0| 6e 73 69 6f 6e 61 6c 20 | 61 72 72 61 79 73 20 61 |nsional |arrays a|
|000047c0| 72 65 20 6e 6f 74 20 64 | 69 72 65 63 74 6c 79 20 |re not d|irectly |
|000047d0| 73 75 70 70 6f 72 74 65 | 64 2c 20 62 75 74 20 73 |supporte|d, but s|
|000047e0| 65 65 20 74 68 65 0d 64 | 69 73 63 75 73 73 69 6f |ee the.d|iscussio|
|000047f0| 6e 20 6f 66 20 74 68 65 | 20 24 3b 20 76 61 72 69 |n of the| $; vari|
|00004800| 61 62 6c 65 20 6c 61 74 | 65 72 20 66 6f 72 20 61 |able lat|er for a|
|00004810| 20 6d 65 61 6e 73 20 6f | 66 20 65 6d 75 6c 61 74 | means o|f emulat|
|00004820| 69 6e 67 20 6d 75 6c 2d | 0d 74 69 70 6c 65 20 73 |ing mul-|.tiple s|
|00004830| 75 62 73 63 72 69 70 74 | 73 20 77 69 74 68 20 61 |ubscript|s with a|
|00004840| 6e 20 61 73 73 6f 63 69 | 61 74 69 76 65 20 61 72 |n associ|ative ar|
|00004850| 72 61 79 2e 20 20 59 6f | 75 20 63 6f 75 6c 64 20 |ray. Yo|u could |
|00004860| 61 6c 73 6f 20 77 72 69 | 74 65 0d 61 20 73 75 62 |also wri|te.a sub|
|00004870| 72 6f 75 74 69 6e 65 20 | 74 6f 20 74 75 72 6e 20 |routine |to turn |
|00004880| 6d 75 6c 74 69 70 6c 65 | 20 73 75 62 73 63 72 69 |multiple| subscri|
|00004890| 70 74 73 20 69 6e 74 6f | 20 61 20 73 69 6e 67 6c |pts into| a singl|
|000048a0| 65 20 73 75 62 73 63 72 | 69 70 74 2e 0d 0d 45 76 |e subscr|ipt...Ev|
|000048b0| 65 72 79 20 64 61 74 61 | 20 74 79 70 65 20 68 61 |ery data| type ha|
|000048c0| 73 20 69 74 73 20 6f 77 | 6e 20 6e 61 6d 65 73 70 |s its ow|n namesp|
|000048d0| 61 63 65 2e 20 20 59 6f | 75 20 63 61 6e 2c 20 77 |ace. Yo|u can, w|
|000048e0| 69 74 68 6f 75 74 20 66 | 65 61 72 20 6f 66 0d 63 |ithout f|ear of.c|
|000048f0| 6f 6e 66 6c 69 63 74 2c | 20 75 73 65 20 74 68 65 |onflict,| use the|
|00004900| 20 73 61 6d 65 20 6e 61 | 6d 65 20 66 6f 72 20 61 | same na|me for a|
|00004910| 20 73 63 61 6c 61 72 20 | 76 61 72 69 61 62 6c 65 | scalar |variable|
|00004920| 2c 20 61 6e 20 61 72 72 | 61 79 2c 20 61 6e 0d 61 |, an arr|ay, an.a|
|00004930| 73 73 6f 63 69 61 74 69 | 76 65 20 61 72 72 61 79 |ssociati|ve array|
|00004940| 2c 20 61 20 66 69 6c 65 | 68 61 6e 64 6c 65 2c 20 |, a file|handle, |
|00004950| 61 20 73 75 62 72 6f 75 | 74 69 6e 65 20 6e 61 6d |a subrou|tine nam|
|00004960| 65 2c 20 61 6e 64 2f 6f | 72 20 61 0d 6c 61 62 65 |e, and/o|r a.labe|
|00004970| 6c 2e 20 20 53 69 6e 63 | 65 20 76 61 72 69 61 62 |l. Sinc|e variab|
|00004980| 6c 65 20 61 6e 64 20 61 | 72 72 61 79 20 72 65 66 |le and a|rray ref|
|00004990| 65 72 65 6e 63 65 73 20 | 61 6c 77 61 79 73 20 73 |erences |always s|
|000049a0| 74 61 72 74 20 77 69 74 | 68 0d 27 24 27 2c 20 27 |tart wit|h.'$', '|
|000049b0| 40 27 2c 20 6f 72 20 27 | 25 27 2c 20 74 68 65 20 |@', or '|%', the |
|000049c0| 22 72 65 73 65 72 76 65 | 64 22 20 77 6f 72 64 73 |"reserve|d" words|
|000049d0| 20 61 72 65 6e 27 74 20 | 69 6e 20 66 61 63 74 20 | aren't |in fact |
|000049e0| 72 65 73 65 72 76 65 64 | 0d 77 69 74 68 20 72 65 |reserved|.with re|
|000049f0| 73 70 65 63 74 20 74 6f | 20 76 61 72 69 61 62 6c |spect to| variabl|
|00004a00| 65 20 6e 61 6d 65 73 2e | 20 20 28 54 68 65 79 20 |e names.| (They |
|00004a10| 41 52 45 20 72 65 73 65 | 72 76 65 64 20 77 69 74 |ARE rese|rved wit|
|00004a20| 68 20 72 65 73 70 65 63 | 74 0d 74 6f 20 6c 61 62 |h respec|t.to lab|
|00004a30| 65 6c 73 20 61 6e 64 20 | 66 69 6c 65 68 61 6e 64 |els and |filehand|
|00004a40| 6c 65 73 2c 20 68 6f 77 | 65 76 65 72 2c 20 77 68 |les, how|ever, wh|
|00004a50| 69 63 68 20 64 6f 6e 27 | 74 20 68 61 76 65 20 61 |ich don'|t have a|
|00004a60| 6e 20 69 6e 69 74 69 61 | 6c 0d 73 70 65 63 69 61 |n initia|l.specia|
|00004a70| 6c 20 63 68 61 72 61 63 | 74 65 72 2e 20 20 48 69 |l charac|ter. Hi|
|00004a80| 6e 74 3a 20 79 6f 75 20 | 63 6f 75 6c 64 20 73 61 |nt: you |could sa|
|00004a90| 79 20 6f 70 65 6e 28 4c | 4f 47 2c 27 6c 6f 67 66 |y open(L|OG,'logf|
|00004aa0| 69 6c 65 27 29 0d 72 61 | 74 68 65 72 20 74 68 61 |ile').ra|ther tha|
|00004ab0| 6e 20 6f 70 65 6e 28 6c | 6f 67 2c 27 6c 6f 67 66 |n open(l|og,'logf|
|00004ac0| 69 6c 65 27 29 2e 20 20 | 55 73 69 6e 67 20 75 70 |ile'). |Using up|
|00004ad0| 70 65 72 63 61 73 65 20 | 66 69 6c 65 68 61 6e 64 |percase |filehand|
|00004ae0| 6c 65 73 0d 61 6c 73 6f | 20 69 6d 70 72 6f 76 65 |les.also| improve|
|00004af0| 73 20 72 65 61 64 61 62 | 69 6c 69 74 79 20 61 6e |s readab|ility an|
|00004b00| 64 20 70 72 6f 74 65 63 | 74 73 20 79 6f 75 20 66 |d protec|ts you f|
|00004b10| 72 6f 6d 20 63 6f 6e 66 | 6c 69 63 74 20 77 69 74 |rom conf|lict wit|
|00004b20| 68 0d 66 75 74 75 72 65 | 20 72 65 73 65 72 76 65 |h.future| reserve|
|00004b30| 64 20 77 6f 72 64 73 2e | 29 20 43 61 73 65 20 49 |d words.|) Case I|
|00004b40| 53 20 73 69 67 6e 69 66 | 69 63 61 6e 74 2d 2d 22 |S signif|icant--"|
|00004b50| 46 4f 4f 22 2c 20 22 46 | 6f 6f 22 20 61 6e 64 0d |FOO", "F|oo" and.|
|00004b60| 22 66 6f 6f 22 20 61 72 | 65 20 61 6c 6c 20 64 69 |"foo" ar|e all di|
|00004b70| 66 66 65 72 65 6e 74 20 | 6e 61 6d 65 73 2e 20 20 |fferent |names. |
|00004b80| 4e 61 6d 65 73 20 77 68 | 69 63 68 20 73 74 61 72 |Names wh|ich star|
|00004b90| 74 20 77 69 74 68 20 61 | 20 6c 65 74 74 65 72 0d |t with a| letter.|
|00004ba0| 6d 61 79 20 61 6c 73 6f | 20 63 6f 6e 74 61 69 6e |may also| contain|
|00004bb0| 20 64 69 67 69 74 73 20 | 61 6e 64 20 75 6e 64 65 | digits |and unde|
|00004bc0| 72 73 63 6f 72 65 73 2e | 20 20 4e 61 6d 65 73 20 |rscores.| Names |
|00004bd0| 77 68 69 63 68 20 64 6f | 20 6e 6f 74 0d 73 74 61 |which do| not.sta|
|00004be0| 72 74 20 77 69 74 68 20 | 61 20 6c 65 74 74 65 72 |rt with |a letter|
|00004bf0| 20 61 72 65 20 6c 69 6d | 69 74 65 64 20 74 6f 20 | are lim|ited to |
|00004c00| 6f 6e 65 20 63 68 61 72 | 61 63 74 65 72 2c 20 65 |one char|acter, e|
|00004c10| 2e 67 2e 20 22 24 25 22 | 20 6f 72 0d 22 24 24 22 |.g. "$%"| or."$$"|
|00004c20| 2e 20 20 28 4d 6f 73 74 | 20 6f 66 20 74 68 65 20 |. (Most| of the |
|00004c30| 6f 6e 65 20 63 68 61 72 | 61 63 74 65 72 20 6e 61 |one char|acter na|
|00004c40| 6d 65 73 20 68 61 76 65 | 20 61 20 70 72 65 64 65 |mes have| a prede|
|00004c50| 66 69 6e 65 64 20 73 69 | 67 6e 69 2d 0d 66 69 63 |fined si|gni-.fic|
|00004c60| 61 6e 63 65 20 74 6f 20 | 70 65 72 6c 2e 20 20 4d |ance to |perl. M|
|00004c70| 6f 72 65 20 6c 61 74 65 | 72 2e 29 0d 0d 4e 75 6d |ore late|r.)..Num|
|00004c80| 65 72 69 63 20 6c 69 74 | 65 72 61 6c 73 20 61 72 |eric lit|erals ar|
|00004c90| 65 20 73 70 65 63 69 66 | 69 65 64 20 69 6e 20 61 |e specif|ied in a|
|00004ca0| 6e 79 20 6f 66 20 74 68 | 65 20 75 73 75 61 6c 20 |ny of th|e usual |
|00004cb0| 66 6c 6f 61 74 69 6e 67 | 20 70 6f 69 6e 74 0d 6f |floating| point.o|
|00004cc0| 72 20 69 6e 74 65 67 65 | 72 20 66 6f 72 6d 61 74 |r intege|r format|
|00004cd0| 73 3a 0d 0d 20 20 20 20 | 20 20 20 20 20 20 31 32 |s:.. | 12|
|00004ce0| 33 34 35 0d 20 20 20 20 | 20 20 20 20 20 20 31 32 |345. | 12|
|00004cf0| 33 34 35 2e 36 37 0d 20 | 20 20 20 20 20 20 20 20 |345.67. | |
|00004d00| 20 2e 32 33 45 2d 31 30 | 0d 20 20 20 20 20 20 20 | .23E-10|. |
|00004d10| 20 20 20 30 78 66 66 66 | 66 20 20 20 20 20 23 20 | 0xfff|f # |
|00004d20| 68 65 78 0d 20 20 20 20 | 20 20 20 20 20 20 30 33 |hex. | 03|
|00004d30| 37 37 20 20 23 20 6f 63 | 74 61 6c 0d 20 20 20 20 |77 # oc|tal. |
|00004d40| 20 20 20 20 20 20 34 5f | 32 39 34 5f 39 36 37 5f | 4_|294_967_|
|00004d50| 32 39 36 0d 0d 53 74 72 | 69 6e 67 20 6c 69 74 65 |296..Str|ing lite|
|00004d60| 72 61 6c 73 20 61 72 65 | 20 64 65 6c 69 6d 69 74 |rals are| delimit|
|00004d70| 65 64 20 62 79 20 65 69 | 74 68 65 72 20 73 69 6e |ed by ei|ther sin|
|00004d80| 67 6c 65 20 6f 72 20 64 | 6f 75 62 6c 65 20 71 75 |gle or d|ouble qu|
|00004d90| 6f 74 65 73 2e 0d 54 68 | 65 79 20 77 6f 72 6b 20 |otes..Th|ey work |
|00004da0| 6d 75 63 68 20 6c 69 6b | 65 20 73 68 65 6c 6c 20 |much lik|e shell |
|00004db0| 71 75 6f 74 65 73 3a 20 | 64 6f 75 62 6c 65 2d 71 |quotes: |double-q|
|00004dc0| 75 6f 74 65 64 20 73 74 | 72 69 6e 67 20 6c 69 74 |uoted st|ring lit|
|00004dd0| 65 72 61 6c 73 0d 61 72 | 65 20 73 75 62 6a 65 63 |erals.ar|e subjec|
|00004de0| 74 20 74 6f 20 62 61 63 | 6b 73 6c 61 73 68 20 61 |t to bac|kslash a|
|00004df0| 6e 64 20 76 61 72 69 61 | 62 6c 65 20 73 75 62 73 |nd varia|ble subs|
|00004e00| 74 69 74 75 74 69 6f 6e | 3b 20 73 69 6e 67 6c 65 |titution|; single|
|00004e10| 2d 71 75 6f 74 65 64 0d | 73 74 72 69 6e 67 73 20 |-quoted.|strings |
|00004e20| 61 72 65 20 6e 6f 74 20 | 28 65 78 63 65 70 74 20 |are not |(except |
|00004e30| 66 6f 72 20 5c 27 20 61 | 6e 64 20 5c 5c 29 2e 20 |for \' a|nd \\). |
|00004e40| 20 54 68 65 20 75 73 75 | 61 6c 20 62 61 63 6b 73 | The usu|al backs|
|00004e50| 6c 61 73 68 0d 72 75 6c | 65 73 20 61 70 70 6c 79 |lash.rul|es apply|
|00004e60| 20 66 6f 72 20 6d 61 6b | 69 6e 67 20 63 68 61 72 | for mak|ing char|
|00004e70| 61 63 74 65 72 73 20 73 | 75 63 68 20 61 73 20 6e |acters s|uch as n|
|00004e80| 65 77 6c 69 6e 65 2c 20 | 74 61 62 2c 20 65 74 63 |ewline, |tab, etc|
|00004e90| 2e 2c 20 61 73 0d 77 65 | 6c 6c 20 61 73 20 73 6f |., as.we|ll as so|
|00004ea0| 6d 65 20 6d 6f 72 65 20 | 65 78 6f 74 69 63 20 66 |me more |exotic f|
|00004eb0| 6f 72 6d 73 3a 0d 0d 20 | 20 20 20 20 5c 74 20 20 |orms:.. | \t |
|00004ec0| 20 20 20 20 20 20 74 61 | 62 0d 20 20 20 20 20 5c | ta|b. \|
|00004ed0| 6e 20 20 20 20 20 20 20 | 20 6e 65 77 6c 69 6e 65 |n | newline|
|00004ee0| 0d 20 20 20 20 20 5c 72 | 20 20 20 20 20 20 20 20 |. \r| |
|00004ef0| 72 65 74 75 72 6e 0d 20 | 20 20 20 20 5c 66 20 20 |return. | \f |
|00004f00| 20 20 20 20 20 20 66 6f | 72 6d 20 66 65 65 64 0d | fo|rm feed.|
|00004f10| 20 20 20 20 20 5c 62 20 | 20 20 20 20 20 20 20 62 | \b | b|
|00004f20| 61 63 6b 73 70 61 63 65 | 0d 20 20 20 20 20 5c 61 |ackspace|. \a|
|00004f30| 20 20 20 20 20 20 20 20 | 61 6c 61 72 6d 20 28 62 | |alarm (b|
|00004f40| 65 6c 6c 29 0d 20 20 20 | 20 20 5c 65 20 20 20 20 |ell). | \e |
|00004f50| 20 20 20 20 65 73 63 61 | 70 65 0d 20 20 20 20 20 | esca|pe. |
|00004f60| 5c 30 33 33 20 20 20 20 | 20 20 6f 63 74 61 6c 20 |\033 | octal |
|00004f70| 63 68 61 72 0d 20 20 20 | 20 20 5c 78 31 62 20 20 |char. | \x1b |
|00004f80| 20 20 20 20 68 65 78 20 | 63 68 61 72 0d 20 20 20 | hex |char. |
|00004f90| 20 20 5c 63 5b 20 20 20 | 20 20 20 20 63 6f 6e 74 | \c[ | cont|
|00004fa0| 72 6f 6c 20 63 68 61 72 | 0d 20 20 20 20 20 5c 6c |rol char|. \l|
|00004fb0| 20 20 20 20 20 20 20 20 | 6c 6f 77 65 72 63 61 73 | |lowercas|
|00004fc0| 65 20 6e 65 78 74 20 63 | 68 61 72 0d 20 20 20 20 |e next c|har. |
|00004fd0| 20 5c 75 20 20 20 20 20 | 20 20 20 75 70 70 65 72 | \u | upper|
|00004fe0| 63 61 73 65 20 6e 65 78 | 74 20 63 68 61 72 0d 20 |case nex|t char. |
|00004ff0| 20 20 20 20 5c 4c 20 20 | 20 20 20 20 20 20 6c 6f | \L | lo|
|00005000| 77 65 72 63 61 73 65 20 | 74 69 6c 6c 20 5c 45 0d |wercase |till \E.|
|00005010| 20 20 20 20 20 5c 55 20 | 20 20 20 20 20 20 20 75 | \U | u|
|00005020| 70 70 65 72 63 61 73 65 | 20 74 69 6c 6c 20 5c 45 |ppercase| till \E|
|00005030| 0d 20 20 20 20 20 5c 45 | 20 20 20 20 20 20 20 20 |. \E| |
|00005040| 65 6e 64 20 63 61 73 65 | 20 6d 6f 64 69 66 69 63 |end case| modific|
|00005050| 61 74 69 6f 6e 0d 0d 59 | 6f 75 20 63 61 6e 20 61 |ation..Y|ou can a|
|00005060| 6c 73 6f 20 65 6d 62 65 | 64 20 6e 65 77 6c 69 6e |lso embe|d newlin|
|00005070| 65 73 20 64 69 72 65 63 | 74 6c 79 20 69 6e 20 79 |es direc|tly in y|
|00005080| 6f 75 72 20 73 74 72 69 | 6e 67 73 2c 20 69 2e 65 |our stri|ngs, i.e|
|00005090| 2e 20 74 68 65 79 0d 63 | 61 6e 20 65 6e 64 20 6f |. they.c|an end o|
|000050a0| 6e 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 6c 69 |n a diff|erent li|
|000050b0| 6e 65 20 74 68 61 6e 20 | 74 68 65 79 20 62 65 67 |ne than |they beg|
|000050c0| 69 6e 2e 20 20 54 68 69 | 73 20 69 73 20 6e 69 63 |in. Thi|s is nic|
|000050d0| 65 2c 20 62 75 74 0d 69 | 66 20 79 6f 75 20 66 6f |e, but.i|f you fo|
|000050e0| 72 67 65 74 20 79 6f 75 | 72 20 74 72 61 69 6c 69 |rget you|r traili|
|000050f0| 6e 67 20 71 75 6f 74 65 | 2c 20 74 68 65 20 65 72 |ng quote|, the er|
|00005100| 72 6f 72 20 77 69 6c 6c | 20 6e 6f 74 20 62 65 20 |ror will| not be |
|00005110| 72 65 70 6f 72 74 65 64 | 0d 75 6e 74 69 6c 20 70 |reported|.until p|
|00005120| 65 72 6c 20 66 69 6e 64 | 73 20 61 6e 6f 74 68 65 |erl find|s anothe|
|00005130| 72 20 6c 69 6e 65 20 63 | 6f 6e 74 61 69 6e 69 6e |r line c|ontainin|
|00005140| 67 20 74 68 65 20 71 75 | 6f 74 65 20 63 68 61 72 |g the qu|ote char|
|00005150| 61 63 74 65 72 2c 0d 77 | 68 69 63 68 20 6d 61 79 |acter,.w|hich may|
|00005160| 20 62 65 20 6d 75 63 68 | 20 66 75 72 74 68 65 72 | be much| further|
|00005170| 20 6f 6e 20 69 6e 20 74 | 68 65 20 73 63 72 69 70 | on in t|he scrip|
|00005180| 74 2e 20 20 56 61 72 69 | 61 62 6c 65 20 73 75 62 |t. Vari|able sub|
|00005190| 73 74 69 74 75 2d 0d 74 | 69 6f 6e 20 69 6e 73 69 |stitu-.t|ion insi|
|000051a0| 64 65 20 73 74 72 69 6e | 67 73 20 69 73 20 6c 69 |de strin|gs is li|
|000051b0| 6d 69 74 65 64 20 74 6f | 20 73 63 61 6c 61 72 20 |mited to| scalar |
|000051c0| 76 61 72 69 61 62 6c 65 | 73 2c 20 6e 6f 72 6d 61 |variable|s, norma|
|000051d0| 6c 20 61 72 72 61 79 0d | 76 61 6c 75 65 73 2c 20 |l array.|values, |
|000051e0| 61 6e 64 20 61 72 72 61 | 79 20 73 6c 69 63 65 73 |and arra|y slices|
|000051f0| 2e 20 20 28 49 6e 20 6f | 74 68 65 72 20 77 6f 72 |. (In o|ther wor|
|00005200| 64 73 2c 20 69 64 65 6e | 74 69 66 69 65 72 73 20 |ds, iden|tifiers |
|00005210| 62 65 67 69 6e 6e 69 6e | 67 0d 77 69 74 68 20 24 |beginnin|g.with $|
|00005220| 20 6f 72 20 40 2c 20 66 | 6f 6c 6c 6f 77 65 64 20 | or @, f|ollowed |
|00005230| 62 79 20 61 6e 20 6f 70 | 74 69 6f 6e 61 6c 20 62 |by an op|tional b|
|00005240| 72 61 63 6b 65 74 65 64 | 20 65 78 70 72 65 73 73 |racketed| express|
|00005250| 69 6f 6e 20 61 73 20 61 | 0d 73 75 62 73 63 72 69 |ion as a|.subscri|
|00005260| 70 74 2e 29 20 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |pt.) The| followi|
|00005270| 6e 67 20 63 6f 64 65 20 | 73 65 67 6d 65 6e 74 20 |ng code |segment |
|00005280| 70 72 69 6e 74 73 20 6f | 75 74 20 22 54 68 65 20 |prints o|ut "The |
|00005290| 70 72 69 63 65 20 69 73 | 0d 24 31 30 30 2e 22 0d |price is|.$100.".|
|000052a0| 0d 20 20 20 20 20 20 20 | 20 20 20 24 50 72 69 63 |. | $Pric|
|000052b0| 65 20 3d 20 27 24 31 30 | 30 27 3b 20 20 20 20 20 |e = '$10|0'; |
|000052c0| 20 20 20 20 20 20 20 20 | 20 20 23 20 6e 6f 74 20 | | # not |
|000052d0| 69 6e 74 65 72 70 72 65 | 74 65 64 0d 20 20 20 20 |interpre|ted. |
|000052e0| 20 20 20 20 20 20 70 72 | 69 6e 74 20 22 54 68 65 | pr|int "The|
|000052f0| 20 70 72 69 63 65 20 69 | 73 20 24 50 72 69 63 65 | price i|s $Price|
|00005300| 2e 5c 6e 22 3b 23 20 69 | 6e 74 65 72 70 72 65 74 |.\n";# i|nterpret|
|00005310| 65 64 0d 0d 4e 6f 74 65 | 20 74 68 61 74 20 79 6f |ed..Note| that yo|
|00005320| 75 20 63 61 6e 20 70 75 | 74 20 63 75 72 6c 79 20 |u can pu|t curly |
|00005330| 62 72 61 63 6b 65 74 73 | 20 61 72 6f 75 6e 64 20 |brackets| around |
|00005340| 74 68 65 20 69 64 65 6e | 74 69 66 69 65 72 20 74 |the iden|tifier t|
|00005350| 6f 0d 64 65 6c 69 6d 69 | 74 20 69 74 20 66 72 6f |o.delimi|t it fro|
|00005360| 6d 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 6c 70 68 |m follow|ing alph|
|00005370| 61 6e 75 6d 65 72 69 63 | 73 2e 20 20 41 6c 73 6f |anumeric|s. Also|
|00005380| 20 6e 6f 74 65 20 74 68 | 61 74 20 61 20 73 69 6e | note th|at a sin|
|00005390| 67 6c 65 0d 71 75 6f 74 | 65 64 20 73 74 72 69 6e |gle.quot|ed strin|
|000053a0| 67 20 6d 75 73 74 20 62 | 65 20 73 65 70 61 72 61 |g must b|e separa|
|000053b0| 74 65 64 20 66 72 6f 6d | 20 61 20 70 72 65 63 65 |ted from| a prece|
|000053c0| 64 69 6e 67 20 77 6f 72 | 64 20 62 79 20 61 20 73 |ding wor|d by a s|
|000053d0| 70 61 63 65 2c 0d 73 69 | 6e 63 65 20 73 69 6e 67 |pace,.si|nce sing|
|000053e0| 6c 65 20 71 75 6f 74 65 | 20 69 73 20 61 20 76 61 |le quote| is a va|
|000053f0| 6c 69 64 20 63 68 61 72 | 61 63 74 65 72 20 69 6e |lid char|acter in|
|00005400| 20 61 6e 20 69 64 65 6e | 74 69 66 69 65 72 20 28 | an iden|tifier (|
|00005410| 73 65 65 0d 50 61 63 6b | 61 67 65 73 29 2e 0d 0d |see.Pack|ages)...|
|00005420| 54 77 6f 20 73 70 65 63 | 69 61 6c 20 6c 69 74 65 |Two spec|ial lite|
|00005430| 72 61 6c 73 20 61 72 65 | 20 5f 5f 4c 49 4e 45 5f |rals are| __LINE_|
|00005440| 5f 20 61 6e 64 20 5f 5f | 46 49 4c 45 5f 5f 2c 20 |_ and __|FILE__, |
|00005450| 77 68 69 63 68 20 72 65 | 70 72 65 73 65 6e 74 0d |which re|present.|
|00005460| 74 68 65 20 63 75 72 72 | 65 6e 74 20 6c 69 6e 65 |the curr|ent line|
|00005470| 20 6e 75 6d 62 65 72 20 | 61 6e 64 20 66 69 6c 65 | number |and file|
|00005480| 6e 61 6d 65 20 61 74 20 | 74 68 61 74 20 70 6f 69 |name at |that poi|
|00005490| 6e 74 20 69 6e 20 79 6f | 75 72 20 70 72 6f 2d 0d |nt in yo|ur pro-.|
|000054a0| 67 72 61 6d 2e 20 20 54 | 68 65 79 20 6d 61 79 20 |gram. T|hey may |
|000054b0| 6f 6e 6c 79 20 62 65 20 | 75 73 65 64 20 61 73 20 |only be |used as |
|000054c0| 73 65 70 61 72 61 74 65 | 20 74 6f 6b 65 6e 73 3b |separate| tokens;|
|000054d0| 20 74 68 65 79 20 77 69 | 6c 6c 20 6e 6f 74 20 62 | they wi|ll not b|
|000054e0| 65 0d 69 6e 74 65 72 70 | 6f 6c 61 74 65 64 20 69 |e.interp|olated i|
|000054f0| 6e 74 6f 20 73 74 72 69 | 6e 67 73 2e 20 20 49 6e |nto stri|ngs. In|
|00005500| 20 61 64 64 69 74 69 6f | 6e 2c 20 74 68 65 20 74 | additio|n, the t|
|00005510| 6f 6b 65 6e 20 5f 5f 45 | 4e 44 5f 5f 20 6d 61 79 |oken __E|ND__ may|
|00005520| 20 62 65 0d 75 73 65 64 | 20 74 6f 20 69 6e 64 69 | be.used| to indi|
|00005530| 63 61 74 65 20 74 68 65 | 20 6c 6f 67 69 63 61 6c |cate the| logical|
|00005540| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 73 63 72 69 | end of |the scri|
|00005550| 70 74 20 62 65 66 6f 72 | 65 20 74 68 65 20 61 63 |pt befor|e the ac|
|00005560| 74 75 61 6c 0d 65 6e 64 | 20 6f 66 20 66 69 6c 65 |tual.end| of file|
|00005570| 2e 20 20 41 6e 79 20 66 | 6f 6c 6c 6f 77 69 6e 67 |. Any f|ollowing|
|00005580| 20 74 65 78 74 20 69 73 | 20 69 67 6e 6f 72 65 64 | text is| ignored|
|00005590| 2c 20 62 75 74 20 6d 61 | 79 20 62 65 20 72 65 61 |, but ma|y be rea|
|000055a0| 64 20 76 69 61 0d 74 68 | 65 20 44 41 54 41 20 66 |d via.th|e DATA f|
|000055b0| 69 6c 65 68 61 6e 64 6c | 65 2e 20 28 54 68 65 20 |ilehandl|e. (The |
|000055c0| 44 41 54 41 20 66 69 6c | 65 68 61 6e 64 6c 65 20 |DATA fil|ehandle |
|000055d0| 6d 61 79 20 72 65 61 64 | 20 64 61 74 61 20 6f 6e |may read| data on|
|000055e0| 6c 79 20 66 72 6f 6d 0d | 74 68 65 20 6d 61 69 6e |ly from.|the main|
|000055f0| 20 73 63 72 69 70 74 2c | 20 62 75 74 20 6e 6f 74 | script,| but not|
|00005600| 20 66 72 6f 6d 20 61 6e | 79 20 72 65 71 75 69 72 | from an|y requir|
|00005610| 65 64 20 66 69 6c 65 20 | 6f 72 20 65 76 61 6c 75 |ed file |or evalu|
|00005620| 61 74 65 64 20 73 74 72 | 69 6e 67 2e 29 0d 54 68 |ated str|ing.).Th|
|00005630| 65 20 74 77 6f 20 63 6f | 6e 74 72 6f 6c 20 63 68 |e two co|ntrol ch|
|00005640| 61 72 61 63 74 65 72 73 | 20 5e 44 20 61 6e 64 20 |aracters| ^D and |
|00005650| 5e 5a 20 61 72 65 20 73 | 79 6e 6f 6e 79 6d 73 20 |^Z are s|ynonyms |
|00005660| 66 6f 72 20 5f 5f 45 4e | 44 5f 5f 2e 0d 0d 41 20 |for __EN|D__...A |
|00005670| 77 6f 72 64 20 74 68 61 | 74 20 64 6f 65 73 6e 27 |word tha|t doesn'|
|00005680| 74 20 68 61 76 65 20 61 | 6e 79 20 6f 74 68 65 72 |t have a|ny other|
|00005690| 20 69 6e 74 65 72 70 72 | 65 74 61 74 69 6f 6e 20 | interpr|etation |
|000056a0| 69 6e 20 74 68 65 20 67 | 72 61 6d 6d 61 72 0d 77 |in the g|rammar.w|
|000056b0| 69 6c 6c 20 62 65 20 74 | 72 65 61 74 65 64 20 61 |ill be t|reated a|
|000056c0| 73 20 69 66 20 69 74 20 | 68 61 64 20 73 69 6e 67 |s if it |had sing|
|000056d0| 6c 65 20 71 75 6f 74 65 | 73 20 61 72 6f 75 6e 64 |le quote|s around|
|000056e0| 20 69 74 2e 20 20 46 6f | 72 20 74 68 69 73 0d 70 | it. Fo|r this.p|
|000056f0| 75 72 70 6f 73 65 2c 20 | 61 20 77 6f 72 64 20 63 |urpose, |a word c|
|00005700| 6f 6e 73 69 73 74 73 20 | 6f 6e 6c 79 20 6f 66 20 |onsists |only of |
|00005710| 61 6c 70 68 61 6e 75 6d | 65 72 69 63 20 63 68 61 |alphanum|eric cha|
|00005720| 72 61 63 74 65 72 73 20 | 61 6e 64 0d 75 6e 64 65 |racters |and.unde|
|00005730| 72 6c 69 6e 65 2c 20 61 | 6e 64 20 6d 75 73 74 20 |rline, a|nd must |
|00005740| 73 74 61 72 74 20 77 69 | 74 68 20 61 6e 20 61 6c |start wi|th an al|
|00005750| 70 68 61 62 65 74 69 63 | 20 63 68 61 72 61 63 74 |phabetic| charact|
|00005760| 65 72 2e 20 20 41 73 20 | 77 69 74 68 0d 66 69 6c |er. As |with.fil|
|00005770| 65 68 61 6e 64 6c 65 73 | 20 61 6e 64 20 6c 61 62 |ehandles| and lab|
|00005780| 65 6c 73 2c 20 61 20 62 | 61 72 65 20 77 6f 72 64 |els, a b|are word|
|00005790| 20 74 68 61 74 20 63 6f | 6e 73 69 73 74 73 20 65 | that co|nsists e|
|000057a0| 6e 74 69 72 65 6c 79 20 | 6f 66 0d 6c 6f 77 65 72 |ntirely |of.lower|
|000057b0| 63 61 73 65 20 6c 65 74 | 74 65 72 73 20 72 69 73 |case let|ters ris|
|000057c0| 6b 73 20 63 6f 6e 66 6c | 69 63 74 20 77 69 74 68 |ks confl|ict with|
|000057d0| 20 66 75 74 75 72 65 20 | 72 65 73 65 72 76 65 64 | future |reserved|
|000057e0| 20 77 6f 72 64 73 2c 20 | 61 6e 64 0d 69 66 20 79 | words, |and.if y|
|000057f0| 6f 75 20 75 73 65 20 74 | 68 65 20 2d 77 20 73 77 |ou use t|he -w sw|
|00005800| 69 74 63 68 2c 20 50 65 | 72 6c 20 77 69 6c 6c 20 |itch, Pe|rl will |
|00005810| 77 61 72 6e 20 79 6f 75 | 20 61 62 6f 75 74 20 61 |warn you| about a|
|00005820| 6e 79 20 73 75 63 68 0d | 77 6f 72 64 73 2e 0d 0d |ny such.|words...|
|00005830| 41 72 72 61 79 20 76 61 | 6c 75 65 73 20 61 72 65 |Array va|lues are|
|00005840| 20 69 6e 74 65 72 70 6f | 6c 61 74 65 64 20 69 6e | interpo|lated in|
|00005850| 74 6f 20 64 6f 75 62 6c | 65 2d 71 75 6f 74 65 64 |to doubl|e-quoted|
|00005860| 20 73 74 72 69 6e 67 73 | 20 62 79 20 6a 6f 69 6e | strings| by join|
|00005870| 2d 0d 69 6e 67 20 61 6c | 6c 20 74 68 65 20 65 6c |-.ing al|l the el|
|00005880| 65 6d 65 6e 74 73 20 6f | 66 20 74 68 65 20 61 72 |ements o|f the ar|
|00005890| 72 61 79 20 77 69 74 68 | 20 74 68 65 20 64 65 6c |ray with| the del|
|000058a0| 69 6d 69 74 65 72 20 73 | 70 65 63 69 66 69 65 64 |imiter s|pecified|
|000058b0| 20 69 6e 0d 74 68 65 20 | 24 22 20 76 61 72 69 61 | in.the |$" varia|
|000058c0| 62 6c 65 2c 20 73 70 61 | 63 65 20 62 79 20 64 65 |ble, spa|ce by de|
|000058d0| 66 61 75 6c 74 2e 20 20 | 28 53 69 6e 63 65 20 69 |fault. |(Since i|
|000058e0| 6e 20 76 65 72 73 69 6f | 6e 73 20 6f 66 20 70 65 |n versio|ns of pe|
|000058f0| 72 6c 0d 70 72 69 6f 72 | 20 74 6f 20 33 2e 30 20 |rl.prior| to 3.0 |
|00005900| 74 68 65 20 40 20 63 68 | 61 72 61 63 74 65 72 20 |the @ ch|aracter |
|00005910| 77 61 73 20 6e 6f 74 20 | 61 20 6d 65 74 61 63 68 |was not |a metach|
|00005920| 61 72 61 63 74 65 72 20 | 69 6e 20 64 6f 75 62 6c |aracter |in doubl|
|00005930| 65 2d 0d 71 75 6f 74 65 | 64 20 73 74 72 69 6e 67 |e-.quote|d string|
|00005940| 73 2c 20 74 68 65 20 69 | 6e 74 65 72 70 6f 6c 61 |s, the i|nterpola|
|00005950| 74 69 6f 6e 20 6f 66 20 | 40 61 72 72 61 79 2c 20 |tion of |@array, |
|00005960| 24 61 72 72 61 79 5b 45 | 58 50 52 5d 2c 0d 40 61 |$array[E|XPR],.@a|
|00005970| 72 72 61 79 5b 4c 49 53 | 54 5d 2c 20 24 61 72 72 |rray[LIS|T], $arr|
|00005980| 61 79 7b 45 58 50 52 7d | 2c 20 6f 72 20 40 61 72 |ay{EXPR}|, or @ar|
|00005990| 72 61 79 7b 4c 49 53 54 | 7d 20 6f 6e 6c 79 20 68 |ray{LIST|} only h|
|000059a0| 61 70 70 65 6e 73 20 69 | 66 20 61 72 72 61 79 0d |appens i|f array.|
|000059b0| 69 73 20 72 65 66 65 72 | 65 6e 63 65 64 20 65 6c |is refer|enced el|
|000059c0| 73 65 77 68 65 72 65 20 | 69 6e 20 74 68 65 20 70 |sewhere |in the p|
|000059d0| 72 6f 67 72 61 6d 20 6f | 72 20 69 73 20 70 72 65 |rogram o|r is pre|
|000059e0| 64 65 66 69 6e 65 64 2e | 29 20 54 68 65 0d 66 6f |defined.|) The.fo|
|000059f0| 6c 6c 6f 77 69 6e 67 20 | 61 72 65 20 65 71 75 69 |llowing |are equi|
|00005a00| 76 61 6c 65 6e 74 3a 0d | 0d 20 20 20 20 20 24 74 |valent:.|. $t|
|00005a10| 65 6d 70 20 3d 20 6a 6f | 69 6e 28 24 22 2c 40 41 |emp = jo|in($",@A|
|00005a20| 52 47 56 29 3b 0d 20 20 | 20 20 20 73 79 73 74 65 |RGV);. | syste|
|00005a30| 6d 20 22 65 63 68 6f 20 | 24 74 65 6d 70 22 3b 0d |m "echo |$temp";.|
|00005a40| 0d 20 20 20 20 20 73 79 | 73 74 65 6d 20 22 65 63 |. sy|stem "ec|
|00005a50| 68 6f 20 40 41 52 47 56 | 22 3b 0d 0d 0d 57 69 74 |ho @ARGV|";...Wit|
|00005a60| 68 69 6e 20 73 65 61 72 | 63 68 20 70 61 74 74 65 |hin sear|ch patte|
|00005a70| 72 6e 73 20 28 77 68 69 | 63 68 20 61 6c 73 6f 20 |rns (whi|ch also |
|00005a80| 75 6e 64 65 72 67 6f 20 | 64 6f 75 62 6c 65 2d 71 |undergo |double-q|
|00005a90| 75 6f 74 69 73 68 20 73 | 75 62 73 74 69 2d 0d 74 |uotish s|ubsti-.t|
|00005aa0| 75 74 69 6f 6e 29 20 74 | 68 65 72 65 20 69 73 20 |ution) t|here is |
|00005ab0| 61 20 62 61 64 20 61 6d | 62 69 67 75 69 74 79 3a |a bad am|biguity:|
|00005ac0| 20 20 49 73 20 2f 24 66 | 6f 6f 5b 62 61 72 5d 2f | Is /$f|oo[bar]/|
|00005ad0| 20 74 6f 20 62 65 20 69 | 6e 74 65 72 2d 0d 70 72 | to be i|nter-.pr|
|00005ae0| 65 74 65 64 20 61 73 20 | 2f 24 7b 66 6f 6f 7d 5b |eted as |/${foo}[|
|00005af0| 62 61 72 5d 2f 20 28 77 | 68 65 72 65 20 5b 62 61 |bar]/ (w|here [ba|
|00005b00| 72 5d 20 69 73 20 61 20 | 63 68 61 72 61 63 74 65 |r] is a |characte|
|00005b10| 72 20 63 6c 61 73 73 20 | 66 6f 72 20 74 68 65 0d |r class |for the.|
|00005b20| 72 65 67 75 6c 61 72 20 | 65 78 70 72 65 73 73 69 |regular |expressi|
|00005b30| 6f 6e 29 20 6f 72 20 61 | 73 20 2f 24 7b 66 6f 6f |on) or a|s /${foo|
|00005b40| 5b 62 61 72 5d 7d 2f 20 | 28 77 68 65 72 65 20 5b |[bar]}/ |(where [|
|00005b50| 62 61 72 5d 20 69 73 20 | 74 68 65 20 73 75 62 2d |bar] is |the sub-|
|00005b60| 0d 73 63 72 69 70 74 20 | 74 6f 20 61 72 72 61 79 |.script |to array|
|00005b70| 20 40 66 6f 6f 29 3f 20 | 20 49 66 20 40 66 6f 6f | @foo)? | If @foo|
|00005b80| 20 64 6f 65 73 6e 27 74 | 20 6f 74 68 65 72 77 69 | doesn't| otherwi|
|00005b90| 73 65 20 65 78 69 73 74 | 2c 20 74 68 65 6e 0d 69 |se exist|, then.i|
|00005ba0| 74 27 73 20 6f 62 76 69 | 6f 75 73 6c 79 20 61 20 |t's obvi|ously a |
|00005bb0| 63 68 61 72 61 63 74 65 | 72 20 63 6c 61 73 73 2e |characte|r class.|
|00005bc0| 20 20 49 66 20 40 66 6f | 6f 20 65 78 69 73 74 73 | If @fo|o exists|
|00005bd0| 2c 20 70 65 72 6c 20 74 | 61 6b 65 73 20 61 0d 67 |, perl t|akes a.g|
|00005be0| 6f 6f 64 20 67 75 65 73 | 73 20 61 62 6f 75 74 20 |ood gues|s about |
|00005bf0| 5b 62 61 72 5d 2c 20 61 | 6e 64 20 69 73 20 61 6c |[bar], a|nd is al|
|00005c00| 6d 6f 73 74 20 61 6c 77 | 61 79 73 20 72 69 67 68 |most alw|ays righ|
|00005c10| 74 2e 20 20 49 66 20 69 | 74 20 64 6f 65 73 0d 67 |t. If i|t does.g|
|00005c20| 75 65 73 73 20 77 72 6f | 6e 67 2c 20 6f 72 20 69 |uess wro|ng, or i|
|00005c30| 66 20 79 6f 75 27 72 65 | 20 6a 75 73 74 20 70 6c |f you're| just pl|
|00005c40| 61 69 6e 20 70 61 72 61 | 6e 6f 69 64 2c 20 79 6f |ain para|noid, yo|
|00005c50| 75 20 63 61 6e 20 66 6f | 72 63 65 20 74 68 65 0d |u can fo|rce the.|
|00005c60| 63 6f 72 72 65 63 74 20 | 69 6e 74 65 72 70 72 65 |correct |interpre|
|00005c70| 74 61 74 69 6f 6e 20 77 | 69 74 68 20 63 75 72 6c |tation w|ith curl|
|00005c80| 79 20 62 72 61 63 6b 65 | 74 73 20 61 73 20 61 62 |y bracke|ts as ab|
|00005c90| 6f 76 65 2e 0d 0d 41 20 | 6c 69 6e 65 2d 6f 72 69 |ove...A |line-ori|
|00005ca0| 65 6e 74 65 64 20 66 6f | 72 6d 20 6f 66 20 71 75 |ented fo|rm of qu|
|00005cb0| 6f 74 69 6e 67 20 69 73 | 20 62 61 73 65 64 20 6f |oting is| based o|
|00005cc0| 6e 20 74 68 65 20 73 68 | 65 6c 6c 20 68 65 72 65 |n the sh|ell here|
|00005cd0| 2d 69 73 0d 73 79 6e 74 | 61 78 2e 20 20 46 6f 6c |-is.synt|ax. Fol|
|00005ce0| 6c 6f 77 69 6e 67 20 61 | 20 3c 3c 20 79 6f 75 20 |lowing a| << you |
|00005cf0| 73 70 65 63 69 66 79 20 | 61 20 73 74 72 69 6e 67 |specify |a string|
|00005d00| 20 74 6f 20 74 65 72 6d | 69 6e 61 74 65 20 74 68 | to term|inate th|
|00005d10| 65 0d 71 75 6f 74 65 64 | 20 6d 61 74 65 72 69 61 |e.quoted| materia|
|00005d20| 6c 2c 20 61 6e 64 20 61 | 6c 6c 20 6c 69 6e 65 73 |l, and a|ll lines|
|00005d30| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 74 68 65 20 63 | followi|ng the c|
|00005d40| 75 72 72 65 6e 74 20 6c | 69 6e 65 20 64 6f 77 6e |urrent l|ine down|
|00005d50| 20 74 6f 0d 74 68 65 20 | 74 65 72 6d 69 6e 61 74 | to.the |terminat|
|00005d60| 69 6e 67 20 73 74 72 69 | 6e 67 20 61 72 65 20 74 |ing stri|ng are t|
|00005d70| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 74 68 65 20 |he value| of the |
|00005d80| 69 74 65 6d 2e 20 20 54 | 68 65 20 74 65 72 6d 69 |item. T|he termi|
|00005d90| 6e 61 74 2d 0d 69 6e 67 | 20 73 74 72 69 6e 67 20 |nat-.ing| string |
|00005da0| 6d 61 79 20 62 65 20 65 | 69 74 68 65 72 20 61 6e |may be e|ither an|
|00005db0| 20 69 64 65 6e 74 69 66 | 69 65 72 20 28 61 20 77 | identif|ier (a w|
|00005dc0| 6f 72 64 29 2c 20 6f 72 | 20 73 6f 6d 65 20 71 75 |ord), or| some qu|
|00005dd0| 6f 74 65 64 0d 74 65 78 | 74 2e 20 20 49 66 20 71 |oted.tex|t. If q|
|00005de0| 75 6f 74 65 64 2c 20 74 | 68 65 20 74 79 70 65 20 |uoted, t|he type |
|00005df0| 6f 66 20 71 75 6f 74 65 | 73 20 79 6f 75 20 75 73 |of quote|s you us|
|00005e00| 65 20 64 65 74 65 72 6d | 69 6e 65 73 20 74 68 65 |e determ|ines the|
|00005e10| 0d 74 72 65 61 74 6d 65 | 6e 74 20 6f 66 20 74 68 |.treatme|nt of th|
|00005e20| 65 20 74 65 78 74 2c 20 | 6a 75 73 74 20 61 73 20 |e text, |just as |
|00005e30| 69 6e 20 72 65 67 75 6c | 61 72 20 71 75 6f 74 69 |in regul|ar quoti|
|00005e40| 6e 67 2e 20 20 41 6e 20 | 75 6e 71 75 6f 74 65 64 |ng. An |unquoted|
|00005e50| 0d 69 64 65 6e 74 69 66 | 69 65 72 20 77 6f 72 6b |.identif|ier work|
|00005e60| 73 20 6c 69 6b 65 20 64 | 6f 75 62 6c 65 20 71 75 |s like d|ouble qu|
|00005e70| 6f 74 65 73 2e 20 20 54 | 68 65 72 65 20 6d 75 73 |otes. T|here mus|
|00005e80| 74 20 62 65 20 6e 6f 20 | 73 70 61 63 65 0d 62 65 |t be no |space.be|
|00005e90| 74 77 65 65 6e 20 74 68 | 65 20 3c 3c 20 61 6e 64 |tween th|e << and|
|00005ea0| 20 74 68 65 20 69 64 65 | 6e 74 69 66 69 65 72 2e | the ide|ntifier.|
|00005eb0| 20 20 28 49 66 20 79 6f | 75 20 70 75 74 20 61 20 | (If yo|u put a |
|00005ec0| 73 70 61 63 65 20 69 74 | 20 77 69 6c 6c 0d 62 65 |space it| will.be|
|00005ed0| 20 74 72 65 61 74 65 64 | 20 61 73 20 61 20 6e 75 | treated| as a nu|
|00005ee0| 6c 6c 20 69 64 65 6e 74 | 69 66 69 65 72 2c 20 77 |ll ident|ifier, w|
|00005ef0| 68 69 63 68 20 69 73 20 | 76 61 6c 69 64 2c 20 61 |hich is |valid, a|
|00005f00| 6e 64 20 6d 61 74 63 68 | 65 73 20 74 68 65 0d 66 |nd match|es the.f|
|00005f10| 69 72 73 74 20 62 6c 61 | 6e 6b 20 6c 69 6e 65 2d |irst bla|nk line-|
|00005f20| 2d 73 65 65 20 4d 65 72 | 72 79 20 43 68 72 69 73 |-see Mer|ry Chris|
|00005f30| 74 6d 61 73 20 65 78 61 | 6d 70 6c 65 20 62 65 6c |tmas exa|mple bel|
|00005f40| 6f 77 2e 29 20 54 68 65 | 20 74 65 72 2d 0d 6d 69 |ow.) The| ter-.mi|
|00005f50| 6e 61 74 69 6e 67 20 73 | 74 72 69 6e 67 20 6d 75 |nating s|tring mu|
|00005f60| 73 74 20 61 70 70 65 61 | 72 20 62 79 20 69 74 73 |st appea|r by its|
|00005f70| 65 6c 66 20 28 75 6e 71 | 75 6f 74 65 64 20 61 6e |elf (unq|uoted an|
|00005f80| 64 20 77 69 74 68 20 6e | 6f 20 73 75 72 2d 0d 72 |d with n|o sur-.r|
|00005f90| 6f 75 6e 64 69 6e 67 20 | 77 68 69 74 65 73 70 61 |ounding |whitespa|
|00005fa0| 63 65 29 20 6f 6e 20 74 | 68 65 20 74 65 72 6d 69 |ce) on t|he termi|
|00005fb0| 6e 61 74 69 6e 67 20 6c | 69 6e 65 2e 0d 0d 70 72 |nating l|ine...pr|
|00005fc0| 69 6e 74 20 3c 3c 45 4f | 46 3b 20 20 20 20 20 20 |int <<EO|F; |
|00005fd0| 20 20 23 20 73 61 6d 65 | 20 61 73 20 61 62 6f 76 | # same| as abov|
|00005fe0| 65 0d 54 68 65 20 70 72 | 69 63 65 20 69 73 20 24 |e.The pr|ice is $|
|00005ff0| 50 72 69 63 65 2e 0d 45 | 4f 46 0d 0d 70 72 69 6e |Price..E|OF..prin|
|00006000| 74 20 3c 3c 22 45 4f 46 | 22 3b 20 20 20 20 20 20 |t <<"EOF|"; |
|00006010| 23 20 73 61 6d 65 20 61 | 73 20 61 62 6f 76 65 0d |# same a|s above.|
|00006020| 54 68 65 20 70 72 69 63 | 65 20 69 73 20 24 50 72 |The pric|e is $Pr|
|00006030| 69 63 65 2e 0d 45 4f 46 | 0d 0d 70 72 69 6e 74 20 |ice..EOF|..print |
|00006040| 3c 3c 20 78 20 31 30 3b | 20 20 20 20 20 20 23 20 |<< x 10;| # |
|00006050| 6e 75 6c 6c 20 69 64 65 | 6e 74 69 66 69 65 72 20 |null ide|ntifier |
|00006060| 69 73 20 64 65 6c 69 6d | 69 74 65 72 0d 4d 65 72 |is delim|iter.Mer|
|00006070| 72 79 20 43 68 72 69 73 | 74 6d 61 73 21 0d 0d 70 |ry Chris|tmas!..p|
|00006080| 72 69 6e 74 20 3c 3c 60 | 45 4f 43 60 3b 20 20 20 |rint <<`|EOC`; |
|00006090| 20 20 20 23 20 65 78 65 | 63 75 74 65 20 63 6f 6d | # exe|cute com|
|000060a0| 6d 61 6e 64 73 0d 65 63 | 68 6f 20 68 69 20 74 68 |mands.ec|ho hi th|
|000060b0| 65 72 65 0d 65 63 68 6f | 20 6c 6f 20 74 68 65 72 |ere.echo| lo ther|
|000060c0| 65 0d 45 4f 43 0d 0d 70 | 72 69 6e 74 20 3c 3c 66 |e.EOC..p|rint <<f|
|000060d0| 6f 6f 2c 20 3c 3c 62 61 | 72 3b 20 23 20 79 6f 75 |oo, <<ba|r; # you|
|000060e0| 20 63 61 6e 20 73 74 61 | 63 6b 20 74 68 65 6d 0d | can sta|ck them.|
|000060f0| 49 20 73 61 69 64 20 66 | 6f 6f 2e 0d 66 6f 6f 0d |I said f|oo..foo.|
|00006100| 49 20 73 61 69 64 20 62 | 61 72 2e 0d 62 61 72 0d |I said b|ar..bar.|
|00006110| 0d 41 72 72 61 79 20 6c | 69 74 65 72 61 6c 73 20 |.Array l|iterals |
|00006120| 61 72 65 20 64 65 6e 6f | 74 65 64 20 62 79 20 73 |are deno|ted by s|
|00006130| 65 70 61 72 61 74 69 6e | 67 20 69 6e 64 69 76 69 |eparatin|g indivi|
|00006140| 64 75 61 6c 20 76 61 6c | 75 65 73 20 62 79 0d 63 |dual val|ues by.c|
|00006150| 6f 6d 6d 61 73 2c 20 61 | 6e 64 20 65 6e 63 6c 6f |ommas, a|nd enclo|
|00006160| 73 69 6e 67 20 74 68 65 | 20 6c 69 73 74 20 69 6e |sing the| list in|
|00006170| 20 70 61 72 65 6e 74 68 | 65 73 65 73 3a 0d 0d 20 | parenth|eses:.. |
|00006180| 20 20 20 20 28 4c 49 53 | 54 29 0d 0d 49 6e 20 61 | (LIS|T)..In a|
|00006190| 20 63 6f 6e 74 65 78 74 | 20 6e 6f 74 20 72 65 71 | context| not req|
|000061a0| 75 69 72 69 6e 67 20 61 | 6e 20 61 72 72 61 79 20 |uiring a|n array |
|000061b0| 76 61 6c 75 65 2c 20 74 | 68 65 20 76 61 6c 75 65 |value, t|he value|
|000061c0| 20 6f 66 20 74 68 65 20 | 61 72 72 61 79 0d 6c 69 | of the |array.li|
|000061d0| 74 65 72 61 6c 20 69 73 | 20 74 68 65 20 76 61 6c |teral is| the val|
|000061e0| 75 65 20 6f 66 20 74 68 | 65 20 66 69 6e 61 6c 20 |ue of th|e final |
|000061f0| 65 6c 65 6d 65 6e 74 2c | 20 61 73 20 69 6e 20 74 |element,| as in t|
|00006200| 68 65 20 43 20 63 6f 6d | 6d 61 0d 6f 70 65 72 61 |he C com|ma.opera|
|00006210| 74 6f 72 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |tor. Fo|r exampl|
|00006220| 65 2c 0d 0d 20 20 20 20 | 20 20 20 20 20 20 40 66 |e,.. | @f|
|00006230| 6f 6f 20 3d 20 28 27 63 | 63 27 2c 20 27 2d 45 27 |oo = ('c|c', '-E'|
|00006240| 2c 20 24 62 61 72 29 3b | 0d 0d 61 73 73 69 67 6e |, $bar);|..assign|
|00006250| 73 20 74 68 65 20 65 6e | 74 69 72 65 20 61 72 72 |s the en|tire arr|
|00006260| 61 79 20 76 61 6c 75 65 | 20 74 6f 20 61 72 72 61 |ay value| to arra|
|00006270| 79 20 66 6f 6f 2c 20 62 | 75 74 0d 0d 20 20 20 20 |y foo, b|ut.. |
|00006280| 20 20 20 20 20 20 24 66 | 6f 6f 20 3d 20 28 27 63 | $f|oo = ('c|
|00006290| 63 27 2c 20 27 2d 45 27 | 2c 20 24 62 61 72 29 3b |c', '-E'|, $bar);|
|000062a0| 0d 0d 61 73 73 69 67 6e | 73 20 74 68 65 20 76 61 |..assign|s the va|
|000062b0| 6c 75 65 20 6f 66 20 76 | 61 72 69 61 62 6c 65 20 |lue of v|ariable |
|000062c0| 62 61 72 20 74 6f 20 76 | 61 72 69 61 62 6c 65 20 |bar to v|ariable |
|000062d0| 66 6f 6f 2e 20 20 4e 6f | 74 65 20 74 68 61 74 20 |foo. No|te that |
|000062e0| 74 68 65 0d 76 61 6c 75 | 65 20 6f 66 20 61 6e 20 |the.valu|e of an |
|000062f0| 61 63 74 75 61 6c 20 61 | 72 72 61 79 20 69 6e 20 |actual a|rray in |
|00006300| 61 20 73 63 61 6c 61 72 | 20 63 6f 6e 74 65 78 74 |a scalar| context|
|00006310| 20 69 73 20 74 68 65 20 | 6c 65 6e 67 74 68 20 6f | is the |length o|
|00006320| 66 20 74 68 65 0d 61 72 | 72 61 79 3b 20 74 68 65 |f the.ar|ray; the|
|00006330| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 61 73 73 69 67 | followi|ng assig|
|00006340| 6e 73 20 74 6f 20 24 66 | 6f 6f 20 74 68 65 20 76 |ns to $f|oo the v|
|00006350| 61 6c 75 65 20 33 3a 0d | 0d 20 20 20 20 20 20 20 |alue 3:.|. |
|00006360| 20 20 20 40 66 6f 6f 20 | 3d 20 28 27 63 63 27 2c | @foo |= ('cc',|
|00006370| 20 27 2d 45 27 2c 20 24 | 62 61 72 29 3b 0d 20 20 | '-E', $|bar);. |
|00006380| 20 20 20 20 20 20 20 20 | 24 66 6f 6f 20 3d 20 40 | |$foo = @|
|00006390| 66 6f 6f 3b 20 20 20 20 | 20 20 20 20 20 23 20 24 |foo; | # $|
|000063a0| 66 6f 6f 20 67 65 74 73 | 20 33 0d 0d 59 6f 75 20 |foo gets| 3..You |
|000063b0| 6d 61 79 20 68 61 76 65 | 20 61 6e 20 6f 70 74 69 |may have| an opti|
|000063c0| 6f 6e 61 6c 20 63 6f 6d | 6d 61 20 62 65 66 6f 72 |onal com|ma befor|
|000063d0| 65 20 74 68 65 20 63 6c | 6f 73 69 6e 67 20 70 61 |e the cl|osing pa|
|000063e0| 72 65 6e 74 68 65 73 69 | 73 20 6f 66 0d 61 6e 20 |renthesi|s of.an |
|000063f0| 61 72 72 61 79 20 6c 69 | 74 65 72 61 6c 2c 20 73 |array li|teral, s|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.