1PERLFAQ1(1)            Perl Programmers Reference Guide            PERLFAQ1(1)
2
3
4

NAME

6       perlfaq1 - General Questions About Perl ($Revision: 1.19 $, $Date:
7       2005/12/31 00:54:37 $)
8

DESCRIPTION

10       This section of the FAQ answers very general, high-level questions
11       about Perl.
12
13       What is Perl?
14
15       Perl is a high-level programming language with an eclectic heritage
16       written by Larry Wall and a cast of thousands.  It derives from the
17       ubiquitous C programming language and to a lesser extent from sed, awk,
18       the Unix shell, and at least a dozen other tools and languages.  Perl's
19       process, file, and text manipulation facilities make it particularly
20       well-suited for tasks involving quick prototyping, system utilities,
21       software tools, system management tasks, database access, graphical
22       programming, networking, and world wide web programming.  These
23       strengths make it especially popular with system administrators and CGI
24       script authors, but mathematicians, geneticists, journalists, and even
25       managers also use Perl.  Maybe you should, too.
26
27       Who supports Perl?  Who develops it?  Why is it free?
28
29       The original culture of the pre-populist Internet and the deeply-held
30       beliefs of Perl's author, Larry Wall, gave rise to the free and open
31       distribution policy of perl.  Perl is supported by its users.  The
32       core, the standard Perl library, the optional modules, and the documen‐
33       tation you're reading now were all written by volunteers.  See the per‐
34       sonal note at the end of the README file in the perl source distribu‐
35       tion for more details.  See perlhist (new as of 5.005) for Perl's mile‐
36       stone releases.
37
38       In particular, the core development team (known as the Perl Porters)
39       are a rag-tag band of highly altruistic individuals committed to pro‐
40       ducing better software for free than you could hope to purchase for
41       money.  You may snoop on pending developments via the archives at
42       http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/ and http://ar
43       chive.develooper.com/perl5-porters@perl.org/ or the news gateway
44       nntp://nntp.perl.org/perl.perl5.porters or its web interface at
45       http://nntp.perl.org/group/perl.perl5.porters , or read the faq at
46       http://simon-cozens.org/writings/p5p-faq , or you can subscribe to the
47       mailing list by sending perl5-porters-request@perl.org a subscription
48       request (an empty message with no subject is fine).
49
50       While the GNU project includes Perl in its distributions, there's no
51       such thing as "GNU Perl".  Perl is not produced nor maintained by the
52       Free Software Foundation.  Perl's licensing terms are also more open
53       than GNU software's tend to be.
54
55       You can get commercial support of Perl if you wish, although for most
56       users the informal support will more than suffice.  See the answer to
57       "Where can I buy a commercial version of perl?" for more information.
58
59       Which version of Perl should I use?
60
61       (contributed by brian d foy)
62
63       There is often a matter of opinion and taste, and there isn't any one
64       answer that fits anyone.  In general, you want to use either the cur‐
65       rent stable release, or the stable release immediately prior to that
66       one.  Currently, those are perl5.8.x and perl5.6.x, respectively.
67
68       Beyond that, you have to consider several things and decide which is
69       best for you.
70
71       ·   If things aren't broken, upgrading perl may break them (or at least
72           issue new warnings).
73
74       ·   The latest versions of perl have more bug fixes.
75
76       ·   The Perl community is geared toward supporting the most recent
77           releases, so you'll have an easier time finding help for those.
78
79       ·   Versions prior to perl5.004 had serious security problems with buf‐
80           fer overflows, and in some cases have CERT advisories (for
81           instance, http://www.cert.org/advisories/CA-1997-17.html ).
82
83       ·   The latest versions are probably the least deployed and widely
84           tested, so you may want to wait a few months after their release
85           and see what problems others have if you are risk averse.
86
87       ·   The immediate, previous releases (i.e. perl5.6.x ) are usually
88           maintained for a while, although not at the same level as the cur‐
89           rent releases.
90
91       ·   No one is actively supporting perl4.x.  Five years ago it was a
92           dead camel carcass (according to this document).  Now it's barely a
93           skeleton as its whitewashed bones have fractured or eroded.
94
95       ·   There is no perl6.x for the next couple of years.  Stay tuned, but
96           don't worry that you'll have to change major versions of Perl soon
97           (i.e. before 2006).
98
99       ·   There are really two tracks of perl development: a maintenance ver‐
100           sion and an experimental version.  The maintenance versions are
101           stable, and have an even number as the minor release (i.e.
102           perl5.8.x, where 8 is the minor release).  The experimental ver‐
103           sions may include features that don't make it into the stable ver‐
104           sions, and have an odd number as the minor release (i.e. perl5.9.x,
105           where 9 is the minor release).
106
107       What are perl4, perl5, or perl6?
108
109       (contributed by brian d foy)
110
111       In short, perl4 is the past, perl5 is the present, and perl6 is the
112       future.
113
114       The number after perl (i.e. the 5 after perl5) is the major release of
115       the perl interpreter as well as the version of the language.  Each
116       major version has significant differences that earlier versions cannot
117       support.
118
119       The current major release of Perl is perl5, and was released in 1994.
120       It can run scripts from the previous major release, perl4 (March 1991),
121       but has significant differences. It introduced the concept of refer‐
122       ences, complex data structures, and modules.  The perl5 interpreter was
123       a complete re-write of the previous perl sources.
124
125       Perl6 is the next major version of Perl, but it's still in development
126       in both its syntax and design.  The work started in 2002 and is still
127       ongoing.  Many of the most interesting features have shown up in the
128       latest versions of perl5, and some perl5 modules allow you to use some
129       perl6 syntax in your programs.  You can learn more about perl6 at
130       http://dev.perl.org/perl6/ .
131
132       See perlhist for a history of Perl revisions.
133
134       What is Ponie?
135
136       At The O'Reilly Open Source Software Convention in 2003, Artur Bergman,
137       Fotango, and The Perl Foundation announced a project to run perl5 on
138       the Parrot virtual machine named Ponie. Ponie stands for Perl On New
139       Internal Engine.  The Perl 5.10 language implementation will be used
140       for Ponie, and there will be no language level differences between
141       perl5 and ponie.  Ponie is not a complete rewrite of perl5.
142
143       For more details, see http://www.poniecode.org/
144
145       What is perl6?
146
147       At The Second O'Reilly Open Source Software Convention, Larry Wall
148       announced Perl6 development would begin in earnest. Perl6 was an oft
149       used term for Chip Salzenberg's project to rewrite Perl in C++ named
150       Topaz. However, Topaz provided valuable insights to the next version of
151       Perl and its implementation, but was ultimately abandoned.
152
153       If you want to learn more about Perl6, or have a desire to help in the
154       crusade to make Perl a better place then peruse the Perl6 developers
155       page at http://dev.perl.org/perl6/ and get involved.
156
157       Perl6 is not scheduled for release yet, and Perl5 will still be sup‐
158       ported for quite awhile after its release. Do not wait for Perl6 to do
159       whatever you need to do.
160
161       "We're really serious about reinventing everything that needs reinvent‐
162       ing."  --Larry Wall
163
164       How stable is Perl?
165
166       Production releases, which incorporate bug fixes and new functionality,
167       are widely tested before release.  Since the 5.000 release, we have
168       averaged only about one production release per year.
169
170       Larry and the Perl development team occasionally make changes to the
171       internal core of the language, but all possible efforts are made toward
172       backward compatibility.  While not quite all perl4 scripts run flaw‐
173       lessly under perl5, an update to perl should nearly never invalidate a
174       program written for an earlier version of perl (barring accidental bug
175       fixes and the rare new keyword).
176
177       Is Perl difficult to learn?
178
179       No, Perl is easy to start learning--and easy to keep learning.  It
180       looks like most programming languages you're likely to have experience
181       with, so if you've ever written a C program, an awk script, a shell
182       script, or even a BASIC program, you're already partway there.
183
184       Most tasks only require a small subset of the Perl language.  One of
185       the guiding mottos for Perl development is "there's more than one way
186       to do it" (TMTOWTDI, sometimes pronounced "tim toady").  Perl's learn‐
187       ing curve is therefore shallow (easy to learn) and long (there's a
188       whole lot you can do if you really want).
189
190       Finally, because Perl is frequently (but not always, and certainly not
191       by definition) an interpreted language, you can write your programs and
192       test them without an intermediate compilation step, allowing you to
193       experiment and test/debug quickly and easily.  This ease of experimen‐
194       tation flattens the learning curve even more.
195
196       Things that make Perl easier to learn: Unix experience, almost any kind
197       of programming experience, an understanding of regular expressions, and
198       the ability to understand other people's code.  If there's something
199       you need to do, then it's probably already been done, and a working
200       example is usually available for free.  Don't forget the new perl mod‐
201       ules, either.  They're discussed in Part 3 of this FAQ, along with
202       CPAN, which is discussed in Part 2.
203
204       How does Perl compare with other languages like Java, Python, REXX,
205       Scheme, or Tcl?
206
207       Favorably in some areas, unfavorably in others.  Precisely which areas
208       are good and bad is often a personal choice, so asking this question on
209       Usenet runs a strong risk of starting an unproductive Holy War.
210
211       Probably the best thing to do is try to write equivalent code to do a
212       set of tasks.  These languages have their own newsgroups in which you
213       can learn about (but hopefully not argue about) them.
214
215       Some comparison documents can be found at
216       http://www.perl.com/doc/FMTEYEWTK/versus/ if you really can't stop
217       yourself.
218
219       Can I do [task] in Perl?
220
221       Perl is flexible and extensible enough for you to use on virtually any
222       task, from one-line file-processing tasks to large, elaborate systems.
223       For many people, Perl serves as a great replacement for shell script‐
224       ing.  For others, it serves as a convenient, high-level replacement for
225       most of what they'd program in low-level languages like C or C++.  It's
226       ultimately up to you (and possibly your management) which tasks you'll
227       use Perl for and which you won't.
228
229       If you have a library that provides an API, you can make any component
230       of it available as just another Perl function or variable using a Perl
231       extension written in C or C++ and dynamically linked into your main
232       perl interpreter.  You can also go the other direction, and write your
233       main program in C or C++, and then link in some Perl code on the fly,
234       to create a powerful application.  See perlembed.
235
236       That said, there will always be small, focused, special-purpose lan‐
237       guages dedicated to a specific problem domain that are simply more con‐
238       venient for certain kinds of problems.  Perl tries to be all things to
239       all people, but nothing special to anyone.  Examples of specialized
240       languages that come to mind include prolog and matlab.
241
242       When shouldn't I program in Perl?
243
244       When your manager forbids it--but do consider replacing them :-).
245
246       Actually, one good reason is when you already have an existing applica‐
247       tion written in another language that's all done (and done well), or
248       you have an application language specifically designed for a certain
249       task (e.g. prolog, make).
250
251       For various reasons, Perl is probably not well-suited for real-time
252       embedded systems, low-level operating systems development work like
253       device drivers or context-switching code, complex multi-threaded
254       shared-memory applications, or extremely large applications.  You'll
255       notice that perl is not itself written in Perl.
256
257       The new, native-code compiler for Perl may eventually reduce the limi‐
258       tations given in the previous statement to some degree, but understand
259       that Perl remains fundamentally a dynamically typed language, not a
260       statically typed one.  You certainly won't be chastised if you don't
261       trust nuclear-plant or brain-surgery monitoring code to it.  And Larry
262       will sleep easier, too--Wall Street programs not withstanding. :-)
263
264       What's the difference between "perl" and "Perl"?
265
266       One bit.  Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to
267       signify the language proper and "perl" the implementation of it, i.e.
268       the current interpreter.  Hence Tom's quip that "Nothing but perl can
269       parse Perl."  You may or may not choose to follow this usage.  For
270       example, parallelism means "awk and perl" and "Python and Perl" look
271       OK, while "awk and Perl" and "Python and perl" do not.  But never write
272       "PERL", because perl is not an acronym, apocryphal folklore and post-
273       facto expansions notwithstanding.
274
275       Is it a Perl program or a Perl script?
276
277       Larry doesn't really care.  He says (half in jest) that "a script is
278       what you give the actors.  A program is what you give the audience."
279
280       Originally, a script was a canned sequence of normally interactive com‐
281       mands--that is, a chat script.  Something like a UUCP or PPP chat
282       script or an expect script fits the bill nicely, as do configuration
283       scripts run by a program at its start up, such .cshrc or .ircrc, for
284       example.  Chat scripts were just drivers for existing programs, not
285       stand-alone programs in their own right.
286
287       A computer scientist will correctly explain that all programs are
288       interpreted and that the only question is at what level.  But if you
289       ask this question of someone who isn't a computer scientist, they might
290       tell you that a program has been compiled to physical machine code once
291       and can then be run multiple times, whereas a script must be translated
292       by a program each time it's used.
293
294       Perl programs are (usually) neither strictly compiled nor strictly
295       interpreted.  They can be compiled to a byte-code form (something of a
296       Perl virtual machine) or to completely different languages, like C or
297       assembly language.  You can't tell just by looking at it whether the
298       source is destined for a pure interpreter, a parse-tree interpreter, a
299       byte-code interpreter, or a native-code compiler, so it's hard to give
300       a definitive answer here.
301
302       Now that "script" and "scripting" are terms that have been seized by
303       unscrupulous or unknowing marketeers for their own nefarious purposes,
304       they have begun to take on strange and often pejorative meanings, like
305       "non serious" or "not real programming".  Consequently, some Perl pro‐
306       grammers prefer to avoid them altogether.
307
308       What is a JAPH?
309
310       These are the "just another perl hacker" signatures that some people
311       sign their postings with.  Randal Schwartz made these famous.  About
312       100 of the earlier ones are available from
313       http://www.cpan.org/misc/japh .
314
315       Where can I get a list of Larry Wall witticisms?
316
317       Over a hundred quips by Larry, from postings of his or source code, can
318       be found at http://www.cpan.org/misc/lwall-quotes.txt.gz .
319
320       How can I convince my sysadmin/supervisor/employees to use version
321       5/5.6.1/Perl instead of some other language?
322
323       If your manager or employees are wary of unsupported software, or soft‐
324       ware which doesn't officially ship with your operating system, you
325       might try to appeal to their self-interest.  If programmers can be more
326       productive using and utilizing Perl constructs, functionality, simplic‐
327       ity, and power, then the typical manager/supervisor/employee may be
328       persuaded.  Regarding using Perl in general, it's also sometimes help‐
329       ful to point out that delivery times may be reduced using Perl compared
330       to other languages.
331
332       If you have a project which has a bottleneck, especially in terms of
333       translation or testing, Perl almost certainly will provide a viable,
334       quick solution.  In conjunction with any persuasion effort, you should
335       not fail to point out that Perl is used, quite extensively, and with
336       extremely reliable and valuable results, at many large computer soft‐
337       ware and hardware companies throughout the world.  In fact, many Unix
338       vendors now ship Perl by default.  Support is usually just a news-post‐
339       ing away, if you can't find the answer in the comprehensive documenta‐
340       tion, including this FAQ.
341
342       See http://www.perl.org/advocacy/ for more information.
343
344       If you face reluctance to upgrading from an older version of perl, then
345       point out that version 4 is utterly unmaintained and unsupported by the
346       Perl Development Team.  Another big sell for Perl5 is the large number
347       of modules and extensions which greatly reduce development time for any
348       given task.  Also mention that the difference between version 4 and
349       version 5 of Perl is like the difference between awk and C++.  (Well,
350       OK, maybe it's not quite that distinct, but you get the idea.)  If you
351       want support and a reasonable guarantee that what you're developing
352       will continue to work in the future, then you have to run the supported
353       version.  As of December 2003 that means running either 5.8.2 (released
354       in November 2003), or one of the older releases like 5.6.2 (also
355       released in November 2003; a maintenance release to let perl 5.6 com‐
356       pile on newer systems as 5.6.1 was released in April 2001) or 5.005_03
357       (released in March 1999), although 5.004_05 isn't that bad if you abso‐
358       lutely need such an old version (released in April 1999) for stability
359       reasons.  Anything older than 5.004_05 shouldn't be used.
360
361       Of particular note is the massive bug hunt for buffer overflow problems
362       that went into the 5.004 release.  All releases prior to that, includ‐
363       ing perl4, are considered insecure and should be upgraded as soon as
364       possible.
365
366       In August 2000 in all Linux distributions a new security problem was
367       found in the optional 'suidperl' (not built or installed by default) in
368       all the Perl branches 5.6, 5.005, and 5.004, see
369       http://www.cpan.org/src/5.0/sperl-2000-08-05/ Perl maintenance releases
370       5.6.1 and 5.8.0 have this security hole closed.  Most, if not all,
371       Linux distribution have patches for this vulnerability available, see
372       http://www.linuxsecurity.com/advisories/ , but the most recommendable
373       way is to upgrade to at least Perl 5.6.1.
374
376       Copyright (c) 1997-2006 Tom Christiansen, Nathan Torkington, and other
377       authors as noted. All rights reserved.
378
379       This documentation is free; you can redistribute it and/or modify it
380       under the same terms as Perl itself.
381
382       Irrespective of its distribution, all code examples here are in the
383       public domain.  You are permitted and encouraged to use this code and
384       any derivatives thereof in your own programs for fun or for profit as
385       you see fit.  A simple comment in the code giving credit to the FAQ
386       would be courteous but is not required.
387
388
389
390perl v5.8.8                       2006-01-07                       PERLFAQ1(1)
Impressum