home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _04b2236644a339ee275e5622ae67cb35 < prev    next >
Text File  |  2000-03-23  |  21KB  |  333 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>perlfaq1 - General Questions About Perl</TITLE>
  4. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  5. <LINK REV="made" HREF="mailto:">
  6. </HEAD>
  7.  
  8. <BODY>
  9. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  10. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  11. <STRONG><P CLASS=block> perlfaq1 - General Questions About Perl</P></STRONG>
  12. </TD></TR>
  13. </TABLE>
  14.  
  15. <A NAME="__index__"></A>
  16. <!-- INDEX BEGIN -->
  17.  
  18. <UL>
  19.  
  20.     <LI><A HREF="#name">NAME</A></LI>
  21.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  22.     <UL>
  23.  
  24.         <LI><A HREF="#what is perl">What is Perl?</A></LI>
  25.         <LI><A HREF="#who supports perl who develops it why is it free">Who supports Perl?  Who develops it?  Why is it free?</A></LI>
  26.         <LI><A HREF="#which version of perl should i use">Which version of Perl should I use?</A></LI>
  27.         <LI><A HREF="#what are perl4 and perl5">What are perl4 and perl5?</A></LI>
  28.         <LI><A HREF="#what is perl6">What is perl6?</A></LI>
  29.         <LI><A HREF="#how stable is perl">How stable is Perl?</A></LI>
  30.         <LI><A HREF="#is perl difficult to learn">Is Perl difficult to learn?</A></LI>
  31.         <LI><A HREF="#how does perl compare with other languages like java, python, rexx, scheme, or tcl">How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?</A></LI>
  32.         <LI><A HREF="#can i do [task] in perl">Can I do [task] in Perl?</A></LI>
  33.         <LI><A HREF="#when shouldn't i program in perl">When shouldn't I program in Perl?</A></LI>
  34.         <LI><A HREF="#what's the difference between perl and perl">What's the difference between ``perl'' and ``Perl''?</A></LI>
  35.         <LI><A HREF="#is it a perl program or a perl script">Is it a Perl program or a Perl script?</A></LI>
  36.         <LI><A HREF="#what is a japh">What is a JAPH?</A></LI>
  37.         <LI><A HREF="#where can i get a list of larry wall witticisms">Where can I get a list of Larry Wall witticisms?</A></LI>
  38.         <LI><A HREF="#how can i convince my sysadmin/supervisor/employees to use version (5/5.005/perl instead of some other language)">How can I convince my sysadmin/supervisor/employees to use version (5/5.005/Perl instead of some other language)?</A></LI>
  39.     </UL>
  40.  
  41.     <LI><A HREF="#author and copyright">AUTHOR AND COPYRIGHT</A></LI>
  42. </UL>
  43. <!-- INDEX END -->
  44.  
  45. <HR>
  46. <P>
  47. <H1><A NAME="name">NAME</A></H1>
  48. <P>perlfaq1 - General Questions About Perl ($Revision: 1.23 $, $Date: 1999/05/23 16:08:30 $)</P>
  49. <P>
  50. <HR>
  51. <H1><A NAME="description">DESCRIPTION</A></H1>
  52. <P>This section of the FAQ answers very general, high-level questions
  53. about Perl.</P>
  54. <P>
  55. <H2><A NAME="what is perl">What is Perl?</A></H2>
  56. <P>Perl is a high-level programming language with an eclectic heritage
  57. written by Larry Wall and a cast of thousands.  It derives from the
  58. ubiquitous C programming language and to a lesser extent from sed,
  59. awk, the Unix shell, and at least a dozen other tools and languages.
  60. Perl's process, file, and text manipulation facilities make it
  61. particularly well-suited for tasks involving quick prototyping, system
  62. utilities, software tools, system management tasks, database access,
  63. graphical programming, networking, and world wide web programming.
  64. These strengths make it especially popular with system administrators
  65. and CGI script authors, but mathematicians, geneticists, journalists,
  66. and even managers also use Perl.  Maybe you should, too.</P>
  67. <P>
  68. <H2><A NAME="who supports perl who develops it why is it free">Who supports Perl?  Who develops it?  Why is it free?</A></H2>
  69. <P>The original culture of the pre-populist Internet and the deeply-held
  70. beliefs of Perl's author, Larry Wall, gave rise to the free and open
  71. distribution policy of perl.  Perl is supported by its users.  The
  72. core, the standard Perl library, the optional modules, and the
  73. documentation you're reading now were all written by volunteers.  See
  74. the personal note at the end of the README file in the perl source
  75. distribution for more details.  See <A HREF="../../lib/Pod/perlhist.html">the perlhist manpage</A> (new as of 5.005)
  76. for Perl's milestone releases.</P>
  77. <P>In particular, the core development team (known as the Perl Porters)
  78. are a rag-tag band of highly altruistic individuals committed
  79. to producing better software for free than you could hope to
  80. purchase for money.  You may snoop on pending developments via
  81. <A HREF="news://news.perl.com/perl.porters-gw/">news://news.perl.com/perl.porters-gw/</A> and the Deja archive at
  82. <A HREF="http://www.deja.com/">http://www.deja.com/</A> using the perl.porters-gw newsgroup, or you can
  83. subscribe to the mailing list by sending <A HREF="mailto:perl5-porters-request@perl.org">perl5-porters-request@perl.org</A>
  84. a subscription request.</P>
  85. <P>While the GNU project includes Perl in its distributions, there's no
  86. such thing as ``GNU Perl''.  Perl is not produced nor maintained by the
  87. Free Software Foundation.  Perl's licensing terms are also more open
  88. than GNU software's tend to be.</P>
  89. <P>You can get commercial support of Perl if you wish, although for most
  90. users the informal support will more than suffice.  See the answer to
  91. ``Where can I buy a commercial version of perl?'' for more information.</P>
  92. <P>
  93. <H2><A NAME="which version of perl should i use">Which version of Perl should I use?</A></H2>
  94. <P>You should definitely use version 5.  Version 4 is old, limited, and
  95. no longer maintained; its last patch (4.036) was in 1992, long ago and
  96. far away.  Sure, it's stable, but so is anything that's dead; in fact,
  97. perl4 had been called a dead, flea-bitten camel carcass.  The most recent
  98. production release is 5.005_03 (although 5.004_05 is still supported).
  99. The most cutting-edge development release is 5.005_57.  Further references
  100. to the Perl language in this document refer to the production release
  101. unless otherwise specified.  There may be one or more official bug fixes
  102. by the time you read this, and also perhaps some experimental versions
  103. on the way to the next release.  All releases prior to 5.004 were subject
  104. to buffer overruns, a grave security issue.</P>
  105. <P>
  106. <H2><A NAME="what are perl4 and perl5">What are perl4 and perl5?</A></H2>
  107. <P>Perl4 and perl5 are informal names for different versions of the Perl
  108. programming language.  It's easier to say ``perl5'' than it is to say
  109. ``the <CODE>5(.004)</CODE> release of Perl'', but some people have interpreted this
  110. to mean there's a language called ``perl5'', which isn't the case.
  111. Perl5 is merely the popular name for the fifth major release (October 1994),
  112. while perl4 was the fourth major release (March 1991).  There was also a
  113. perl1 (in January 1988), a perl2 (June 1988), and a perl3 (October 1989).</P>
  114. <P>The 5.0 release is, essentially, a ground-up rewrite of the original
  115. perl source code from releases 1 through 4.  It has been modularized,
  116. object-oriented, tweaked, trimmed, and optimized until it almost doesn't
  117. look like the old code.  However, the interface is mostly the same, and
  118. compatibility with previous releases is very high. See <A HREF="../../lib/Pod/perltrap.html#perl4 to perl5 traps">Perl4 to Perl5 Traps in the perltrap manpage</A>.</P>
  119. <P>To avoid the ``what language is perl5?'' confusion, some people prefer to
  120. simply use ``perl'' to refer to the latest version of perl and avoid using
  121. ``perl5'' altogether.  It's not really that big a deal, though.</P>
  122. <P>See <A HREF="../../lib/Pod/perlhist.html">the perlhist manpage</A> for a history of Perl revisions.</P>
  123. <P>
  124. <H2><A NAME="what is perl6">What is perl6?</A></H2>
  125. <P>Perl6 is a semi-jocular reference to the Topaz project.  Headed by Chip
  126. Salzenberg, Topaz is yet-another ground-up rewrite of the current release
  127. of Perl, one whose major goal is to create a more maintainable core than
  128. found in release 5.  Written in nominally portable C++, Topaz hopes to
  129. maintain 100% source-compatibility with previous releases of Perl but to
  130. run significantly faster and smaller.  The Topaz team hopes to provide
  131. an XS compatibility interface to allow most XS modules to work unchanged,
  132. albeit perhaps without the efficiency that the new interface would allow.
  133. New features in Topaz are as yet undetermined, and will be addressed
  134. once compatibility and performance goals are met.</P>
  135. <P>If you are a hard-working C++ wizard with a firm command of Perl's
  136. internals, and you would like to work on the project, send a request to
  137. <A HREF="mailto:perl6-porters-request@perl.org">perl6-porters-request@perl.org</A> to subscribe to the Topaz mailing list.</P>
  138. <P>There is no ETA for Topaz.  It is expected to be several years before it
  139. achieves enough robustness, compatibility, portability, and performance
  140. to replace perl5 for ordinary use by mere mortals.</P>
  141. <P>
  142. <H2><A NAME="how stable is perl">How stable is Perl?</A></H2>
  143. <P>Production releases, which incorporate bug fixes and new functionality,
  144. are widely tested before release.  Since the 5.000 release, we have
  145. averaged only about one production release per year.</P>
  146. <P>Larry and the Perl development team occasionally make changes to the
  147. internal core of the language, but all possible efforts are made toward
  148. backward compatibility.  While not quite all perl4 scripts run flawlessly
  149. under perl5, an update to perl should nearly never invalidate a program
  150. written for an earlier version of perl (barring accidental bug fixes
  151. and the rare new keyword).</P>
  152. <P>
  153. <H2><A NAME="is perl difficult to learn">Is Perl difficult to learn?</A></H2>
  154. <P>No, Perl is easy to start learning -- and easy to keep learning.  It looks
  155. like most programming languages you're likely to have experience
  156. with, so if you've ever written a C program, an awk script, a shell
  157. script, or even a BASIC program, you're already part way there.</P>
  158. <P>Most tasks only require a small subset of the Perl language.  One of
  159. the guiding mottos for Perl development is ``there's more than one way
  160. to do it'' (TMTOWTDI, sometimes pronounced ``tim toady'').  Perl's
  161. learning curve is therefore shallow (easy to learn) and long (there's
  162. a whole lot you can do if you really want).</P>
  163. <P>Finally, because Perl is frequently (but not always, and certainly not by
  164. definition) an interpreted language, you can write your programs and test
  165. them without an intermediate compilation step, allowing you to experiment
  166. and test/debug quickly and easily.  This ease of experimentation flattens
  167. the learning curve even more.</P>
  168. <P>Things that make Perl easier to learn: Unix experience, almost any kind
  169. of programming experience, an understanding of regular expressions, and
  170. the ability to understand other people's code.  If there's something you
  171. need to do, then it's probably already been done, and a working example is
  172. usually available for free.  Don't forget the new perl modules, either.
  173. They're discussed in Part 3 of this FAQ, along with CPAN, which is
  174. discussed in Part 2.</P>
  175. <P>
  176. <H2><A NAME="how does perl compare with other languages like java, python, rexx, scheme, or tcl">How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?</A></H2>
  177. <P>Favorably in some areas, unfavorably in others.  Precisely which areas
  178. are good and bad is often a personal choice, so asking this question
  179. on Usenet runs a strong risk of starting an unproductive Holy War.</P>
  180. <P>Probably the best thing to do is try to write equivalent code to do a
  181. set of tasks.  These languages have their own newsgroups in which you
  182. can learn about (but hopefully not argue about) them.</P>
  183. <P>Some comparison documents can be found at <A HREF="http://language.perl.com/versus/">http://language.perl.com/versus/</A>
  184. if you really can't stop yourself.</P>
  185. <P>
  186. <H2><A NAME="can i do [task] in perl">Can I do [task] in Perl?</A></H2>
  187. <P>Perl is flexible and extensible enough for you to use on virtually any
  188. task, from one-line file-processing tasks to large, elaborate systems.
  189. For many people, Perl serves as a great replacement for shell scripting.
  190. For others, it serves as a convenient, high-level replacement for most of
  191. what they'd program in low-level languages like C or C++.  It's ultimately
  192. up to you (and possibly your management) which tasks you'll use Perl
  193. for and which you won't.</P>
  194. <P>If you have a library that provides an API, you can make any component
  195. of it available as just another Perl function or variable using a Perl
  196. extension written in C or C++ and dynamically linked into your main
  197. perl interpreter.  You can also go the other direction, and write your
  198. main program in C or C++, and then link in some Perl code on the fly,
  199. to create a powerful application.  See <A HREF="../../lib/Pod/perlembed.html">the perlembed manpage</A>.</P>
  200. <P>That said, there will always be small, focused, special-purpose
  201. languages dedicated to a specific problem domain that are simply more
  202. convenient for certain kinds of problems.  Perl tries to be all things
  203. to all people, but nothing special to anyone.  Examples of specialized
  204. languages that come to mind include prolog and matlab.</P>
  205. <P>
  206. <H2><A NAME="when shouldn't i program in perl">When shouldn't I program in Perl?</A></H2>
  207. <P>When your manager forbids it -- but do consider replacing them :-).</P>
  208. <P>Actually, one good reason is when you already have an existing
  209. application written in another language that's all done (and done
  210. well), or you have an application language specifically designed for a
  211. certain task (e.g. prolog, make).</P>
  212. <P>For various reasons, Perl is probably not well-suited for real-time
  213. embedded systems, low-level operating systems development work like
  214. device drivers or context-switching code, complex multi-threaded
  215. shared-memory applications, or extremely large applications.  You'll
  216. notice that perl is not itself written in Perl.</P>
  217. <P>The new, native-code compiler for Perl may eventually reduce the
  218. limitations given in the previous statement to some degree, but understand
  219. that Perl remains fundamentally a dynamically typed language, not
  220. a statically typed one.  You certainly won't be chastised if you don't
  221. trust nuclear-plant or brain-surgery monitoring code to it.  And Larry
  222. will sleep easier, too -- Wall Street programs not withstanding. :-)</P>
  223. <P>
  224. <H2><A NAME="what's the difference between perl and perl">What's the difference between ``perl'' and ``Perl''?</A></H2>
  225. <P>One bit.  Oh, you weren't talking ASCII? :-) Larry now uses ``Perl'' to
  226. signify the language proper and ``perl'' the implementation of it,
  227. i.e. the current interpreter.  Hence Tom's quip that ``Nothing but perl
  228. can parse Perl.''  You may or may not choose to follow this usage.  For
  229. example, parallelism means ``awk and perl'' and ``Python and Perl'' look
  230. OK, while ``awk and Perl'' and ``Python and perl'' do not.  But never
  231. write ``PERL'', because perl isn't really an acronym, apocryphal
  232. folklore and post-facto expansions notwithstanding.</P>
  233. <P>
  234. <H2><A NAME="is it a perl program or a perl script">Is it a Perl program or a Perl script?</A></H2>
  235. <P>Larry doesn't really care.  He says (half in jest) that ``a script is
  236. what you give the actors.  A program is what you give the audience.''</P>
  237. <P>Originally, a script was a canned sequence of normally interactive
  238. commands, that is, a chat script.  Something like a UUCP or PPP chat
  239. script or an expect script fits the bill nicely, as do configuration
  240. scripts run by a program at its start up, such <EM>.cshrc</EM> or <EM>.ircrc</EM>,
  241. for example.  Chat scripts were just drivers for existing programs,
  242. not stand-alone programs in their own right.</P>
  243. <P>A computer scientist will correctly explain that all programs are
  244. interpreted, and that the only question is at what level.  But if you
  245. ask this question of someone who isn't a computer scientist, they might
  246. tell you that a <EM>program</EM> has been compiled to physical machine code
  247. once, and can then be run multiple times, whereas a <EM>script</EM> must be
  248. translated by a program each time it's used.</P>
  249. <P>Perl programs are (usually) neither strictly compiled nor strictly
  250. interpreted.  They can be compiled to a byte-code form (something of a
  251. Perl virtual machine) or to completely different languages, like C or
  252. assembly language.  You can't tell just by looking at it whether the
  253. source is destined for a pure interpreter, a parse-tree interpreter,
  254. a byte-code interpreter, or a native-code compiler, so it's hard to give
  255. a definitive answer here.</P>
  256. <P>Now that ``script'' and ``scripting'' are terms that have been seized by
  257. unscrupulous or unknowing marketeers for their own nefarious purposes,
  258. they have begun to take on strange and often pejorative meanings,
  259. like ``non serious'' or ``not real programming''.  Consequently, some Perl
  260. programmers prefer to avoid them altogether.</P>
  261. <P>
  262. <H2><A NAME="what is a japh">What is a JAPH?</A></H2>
  263. <P>These are the ``just another perl hacker'' signatures that some people
  264. sign their postings with.  Randal Schwartz made these famous.  About
  265. 100 of the earlier ones are available from
  266. <A HREF="http://www.perl.com/CPAN/misc/japh">http://www.perl.com/CPAN/misc/japh</A> .</P>
  267. <P>
  268. <H2><A NAME="where can i get a list of larry wall witticisms">Where can I get a list of Larry Wall witticisms?</A></H2>
  269. <P>Over a hundred quips by Larry, from postings of his or source code,
  270. can be found at <A HREF="http://www.perl.com/CPAN/misc/lwall-quotes.txt.gz">http://www.perl.com/CPAN/misc/lwall-quotes.txt.gz</A> .</P>
  271. <P>Newer examples can be found by perusing Larry's postings:</P>
  272. <PRE>
  273.     <A HREF="http://x1.dejanews.com/dnquery.xp?QRY=">http://x1.dejanews.com/dnquery.xp?QRY=</A>*&DBS=2&ST=PS&defaultOp=AND&LNG=ALL&format=terse&showsort=date&maxhits=100&subjects=&groups=&authors=larry@*wall.org&fromdate=&todate=</PRE>
  274. <P>
  275. <H2><A NAME="how can i convince my sysadmin/supervisor/employees to use version (5/5.005/perl instead of some other language)">How can I convince my sysadmin/supervisor/employees to use version (5/5.005/Perl instead of some other language)?</A></H2>
  276. <P>If your manager or employees are wary of unsupported software, or
  277. software which doesn't officially ship with your operating system, you
  278. might try to appeal to their self-interest.  If programmers can be
  279. more productive using and utilizing Perl constructs, functionality,
  280. simplicity, and power, then the typical manager/supervisor/employee
  281. may be persuaded.  Regarding using Perl in general, it's also
  282. sometimes helpful to point out that delivery times may be reduced
  283. using Perl, as compared to other languages.</P>
  284. <P>If you have a project which has a bottleneck, especially in terms of
  285. translation or testing, Perl almost certainly will provide a viable,
  286. and quick solution.  In conjunction with any persuasion effort, you
  287. should not fail to point out that Perl is used, quite extensively, and
  288. with extremely reliable and valuable results, at many large computer
  289. software and/or hardware companies throughout the world.  In fact,
  290. many Unix vendors now ship Perl by default, and support is usually
  291. just a news-posting away, if you can't find the answer in the
  292. <EM>comprehensive</EM> documentation, including this FAQ.</P>
  293. <P>See <A HREF="http://www.perl.org/advocacy/">http://www.perl.org/advocacy/</A> for more information.</P>
  294. <P>If you face reluctance to upgrading from an older version of perl,
  295. then point out that version 4 is utterly unmaintained and unsupported
  296. by the Perl Development Team.  Another big sell for Perl5 is the large
  297. number of modules and extensions which greatly reduce development time
  298. for any given task.  Also mention that the difference between version
  299. 4 and version 5 of Perl is like the difference between awk and C++.
  300. (Well, OK, maybe not quite that distinct, but you get the idea.)  If you
  301. want support and a reasonable guarantee that what you're developing
  302. will continue to work in the future, then you have to run the supported
  303. version.  That probably means running the 5.005 release, although 5.004
  304. isn't that bad.  Several important bugs were fixed from the 5.000 through
  305. 5.003 versions, though, so try upgrading past them if possible.</P>
  306. <P>Of particular note is the massive bug hunt for buffer overflow
  307. problems that went into the 5.004 release.  All releases prior to
  308. that, including perl4, are considered insecure and should be upgraded
  309. as soon as possible.</P>
  310. <P>
  311. <HR>
  312. <H1><A NAME="author and copyright">AUTHOR AND COPYRIGHT</A></H1>
  313. <P>Copyright (c) 1997, 1998, 1999 Tom Christiansen and Nathan Torkington.
  314. All rights reserved.</P>
  315. <P>When included as an integrated part of the Standard Distribution
  316. of Perl or of its documentation (printed or otherwise), this works is
  317. covered under Perl's Artistic Licence.  For separate distributions of
  318. all or part of this FAQ outside of that, see <A HREF="../../lib/Pod/perlfaq.html">the perlfaq manpage</A>.</P>
  319. <P>Irrespective of its distribution, all code examples here are in the public
  320. domain.  You are permitted and encouraged to use this code and any
  321. derivatives thereof in your own programs for fun or for profit as you
  322. see fit.  A simple comment in the code giving credit to the FAQ would
  323. be courteous but is not required.</P>
  324. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  325. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  326. <STRONG><P CLASS=block> perlfaq1 - General Questions About Perl</P></STRONG>
  327. </TD></TR>
  328. </TABLE>
  329.  
  330. </BODY>
  331.  
  332. </HTML>
  333.