📄 00000019.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: dfbb (赵无忌), 信区: Linux <BR>标 题: [doc]Programminl Perl Chap1 <BR>发信站: BBS 水木清华站 (Fri May 8 22:06:33 1998) <BR> <BR> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <BR> <HTML> <BR> <HEAD> <BR> <TITLE>[Chapter 1] An Overview of Perl[Chapter 1] 1.2 Natural and Artificial Languages[Chapter 1] 1.3 A Grade Example[Chapter 1] 1.4 Filehandles[Chapter 1] 1.5 Operators[Chapter 1] 1.6 Control Structures[Chapter 1] 1.7 Regular Expressions[Chapter 1] <BR>1.8 List Processing[Chapter 1] 1.9 What You Don't Know Won't Hurt You (Much)</TITLE> <BR> <META NAME="author" CONTENT="Larry Wall, Tom Christiansen, and Randal Schwartz"> <BR> <META NAME="date" CONTENT="Fri Aug 29 18:27:39 1997"> <BR> <META NAME="form" CONTENT="html"> <BR> <META NAME="metadata" CONTENT="dublincore.0.1"> <BR> <META NAME="objecttype" CONTENT="book part"> <BR> <META NAME="otheragent" CONTENT="gmat dbtohtml"> <BR> <META NAME="publisher" CONTENT="O'Reilly & Associates, Inc."> <BR> <META NAME="source" CONTENT="SGML"> <BR> <META NAME="subject" CONTENT="Perl"> <BR> <META NAME="title" CONTENT="Programming Perl, Second Edition"> <BR> <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript"> <BR> <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]"> <BR> </HEAD> <BR> <BODY TEXT="#000000" BGCOLOR="#FFFFFF"> <BR> <BR> <H1><A NAME="PERL2-CH-1"></A>1. An Overview of Perl</H1> <BR> <BR> <P><B>Contents:<BR> <BR> </B>Getting Started<BR> <BR> <A HREF="ch01_02.htm">Natural and Artificial Languages<BR> <BR> </A><A HREF="ch01_03.htm">A Grade Example<BR> <BR> </A><A HREF="ch01_04.htm">Filehandles<BR> <BR> </A><A HREF="ch01_05.htm">Operators<BR> <BR> </A><A HREF="ch01_06.htm">Control Structures<BR> <BR> </A><A HREF="ch01_07.htm">Regular Expressions<BR> <BR> </A><A HREF="ch01_08.htm">List Processing<BR> <BR> </A><A HREF="ch01_09.htm">What You Don't Know Won't Hurt You (Much)</A><BR> <BR> </P> <BR> <BR> <H2><A NAME="PERL2-CH-1-SECT-1"></A>1.1 Getting Started</H2> <BR> <BR> <P>We think that Perl is an easy language to learn and use, and we hope <BR> to convince you that we're right. One thing that's easy about Perl is that <BR> you don't have to say much before you say what you want to say. In many <BR> programming languages, you have to declare the types, variables, and subroutines <BR> you are going to use before you can write the first statement of executable <BR> code. And for complex problems demanding complex data structures, this <BR> is a good idea. But for many simple, everyday problems, you would like <BR> a programming language in which you can simply say: </P> <BR> <BR> <PRE>print &quot;Howdy, world!\n&quot;; <BR> </PRE> <BR> <BR> <P>and expect the program to do just that. </P> <BR> <BR> <P>Perl is such a language. In fact, the example is a complete program,[1] <BR> and if you feed it to the Perl interpreter, it will print &quot;<TT>Howdy, <BR> world!</TT>&quot; on your screen. </P> <BR> <BR> <BLOCKQUOTE class=footnote> <BR> <P>[1] Or script, or application, or executable, or doohickey. Whatever. <BR> </P> <BR> </BLOCKQUOTE> <BR> <BR> <P>And that's that. You don't have to say much <I>after</I> you say what <BR> you want to say, either. Unlike many languages, Perl thinks that falling <BR> off the end of your program is just a normal way to exit the program. You <BR> certainly <I>may</I> call the <A HREF="ch03_02.htm#PERL2-CMD-EXIT">exit</A> <BR> function explicitly if you wish, just as you <I>may</I> declare some of <BR> your variables and subroutines, or even <I>force</I> yourself to declare <BR> all your variables and subroutines. But it's your choice. With Perl you're <BR> free to do The Right Thing, however you care to define it. </P> <BR> <BR> <P>There are many other reasons why Perl is easy to use, but it would be <BR> pointless to list them all here, because that's what the rest of the book <BR> is for. The devil may be in the details, as they say, but Perl tries to <BR> help you out down there in the hot place too. At every level, Perl is about <BR> helping you get from here to there with minimum fuss and maximum enjoyment. <BR> That's why so many Perl programmers go around with a silly grin on their <BR> face. </P> <BR> <BR> <P>This chapter is an overview of Perl, so we're not trying to present <BR> Perl to the rational side of your brain. Nor are we trying to be complete, <BR> or logical. That's what the next chapter is for.[2] This chapter presents <BR> Perl to the <I>other</I> side of your brain, whether you prefer to call <BR> it associative, artistic, passionate, or merely spongy. To that end, we'll <BR> be presenting various views of Perl that will hopefully give you as clear <BR> a picture of Perl as the blind men had of the elephant. Well, okay, maybe <BR> we can do better than that. We're dealing with a camel here. Hopefully, <BR> at least one of these views of Perl will help get you over the hump. </P> <BR> <BR> <BLOCKQUOTE class=footnote> <BR> <P>[2] Vulcans (and like-minded humans) should skip this overview and go <BR> straight to <A HREF="ch02_01.htm">Chapter 2, <I>The Gory Details</I></A>, <BR> for maximum information density. If, on the other hand, you're looking <BR> for a carefully paced tutorial, you should probably get Randal's nice book, <BR> <I>Learning Perl</I> (published by O'Reilly &amp; Associates). But don't <BR> throw out this book just yet. </P> <BR> </BLOCKQUOTE> <BR> <BR> <H2><A NAME="PERL2-CH-1-SECT-2"></A>1.2 Natural and Artificial Languages</H2> <BR> <BR> <P><A NAME="CH01.LANG"></A><A NAME="CH01.NAT"></A><A NAME="CH01.ART"></A>Languages <BR> were first invented by humans, for the benefit of humans. In the annals <BR> of computer science, this fact has occasionally been forgotten.[3] Since <BR> Perl was designed (loosely speaking) by an occasional linguist, it was <BR> designed to work smoothly in the same ways that natural language works <BR> smoothly. Naturally, there are many aspects to this, since natural language <BR> works well at many levels simultaneously. We could enumerate many of these <BR> linguistic principles here, but the most important principle of language <BR> design is simply that easy things should be easy, and hard things should <BR> be possible. That may seem obvious, but many computer languages fail at <BR> one or the other. </P> <BR> <BR> <BLOCKQUOTE class=footnote> <BR> <P>[3] More precisely, this fact has occasionally been remembered. </P> <BR> </BLOCKQUOTE> <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -