3 perlfaq1 - General Questions About Perl
7 This section of the FAQ answers very general, high-level questions
12 Perl is a high-level programming language with an eclectic heritage
13 written by Larry Wall and a cast of thousands.
15 Perl's process, file, and text manipulation facilities make it
16 particularly well-suited for tasks involving quick prototyping, system
17 utilities, software tools, system management tasks, database access,
18 graphical programming, networking, and web programming.
20 Perl derives from the ubiquitous C programming language and to a
21 lesser extent from sed, awk, the Unix shell, and many other tools
24 These strengths make it especially popular with web developers
25 and system administrators. Mathematicians, geneticists, journalists,
26 managers and many other people also use Perl.
28 =head2 Who supports Perl? Who develops it? Why is it free?
30 The original culture of the pre-populist Internet and the deeply-held
31 beliefs of Perl's author, Larry Wall, gave rise to the free and open
32 distribution policy of Perl. Perl is supported by its users. The
33 core, the standard Perl library, the optional modules, and the
34 documentation you're reading now were all written by volunteers.
36 The core development team (known as the Perl Porters)
37 are a group of highly altruistic individuals committed to
38 producing better software for free than you could hope to purchase for
39 money. You may snoop on pending developments via the
40 L<archives|http://www.nntp.perl.org/group/perl.perl5.porters/>
41 or read the L<faq|http://dev.perl.org/perl5/docs/p5p-faq.html>,
42 or you can subscribe to the mailing list by sending
43 perl5-porters-subscribe@perl.org a subscription request
44 (an empty message with no subject is fine).
46 While the GNU project includes Perl in its distributions, there's no
47 such thing as "GNU Perl". Perl is not produced nor maintained by the
48 Free Software Foundation. Perl's licensing terms are also more open
49 than GNU software's tend to be.
51 You can get commercial support of Perl if you wish, although for most
52 users the informal support will more than suffice. See the answer to
53 "Where can I buy a commercial version of Perl?" for more information.
55 =head2 Which version of Perl should I use?
57 (contributed by brian d foy)
59 There is often a matter of opinion and taste, and there isn't any one
60 answer that fits everyone. In general, you want to use either the current
61 stable release, or the stable release immediately prior to that one.
62 Currently, those are perl5.18.x and perl5.16.x, respectively.
64 Beyond that, you have to consider several things and decide which is best
71 If things aren't broken, upgrading perl may break them (or at least issue
76 The latest versions of perl have more bug fixes.
80 The Perl community is geared toward supporting the most recent releases,
81 so you'll have an easier time finding help for those.
85 Versions prior to perl5.004 had serious security problems with buffer
86 overflows, and in some cases have CERT advisories (for instance,
87 L<http://www.cert.org/advisories/CA-1997-17.html> ).
91 The latest versions are probably the least deployed and widely tested, so
92 you may want to wait a few months after their release and see what
93 problems others have if you are risk averse.
97 The immediate, previous releases (i.e. perl5.14.x ) are usually maintained
98 for a while, although not at the same level as the current releases.
102 No one is actively supporting Perl 4. Ten years ago it was a dead
103 camel carcass (according to this document). Now it's barely a skeleton
104 as its whitewashed bones have fractured or eroded.
108 The current leading implementation of Perl 6, Rakudo, released a "useful,
109 usable, 'early adopter'" distribution of Perl 6 (called Rakudo Star) in July of
110 2010. Please see L<http://rakudo.org/> for more information.
114 There are really two tracks of perl development: a maintenance version
115 and an experimental version. The maintenance versions are stable, and
116 have an even number as the minor release (i.e. perl5.18.x, where 18 is the
117 minor release). The experimental versions may include features that
118 don't make it into the stable versions, and have an odd number as the
119 minor release (i.e. perl5.19.x, where 19 is the minor release).
123 =head2 What are Perl 4, Perl 5, or Perl 6?
125 In short, Perl 4 is the parent to both Perl 5 and Perl 6. Perl 5 is the older
126 sibling, and though they are different languages, someone who knows one will
127 spot many similarities in the other.
129 The number after Perl (i.e. the 5 after Perl 5) is the major release
130 of the perl interpreter as well as the version of the language. Each
131 major version has significant differences that earlier versions cannot
134 The current major release of Perl is Perl 5, first released in
135 1994. It can run scripts from the previous major release, Perl 4
136 (March 1991), but has significant differences.
138 Perl 6 is a reinvention of Perl, it is a language in the same lineage but
139 not compatible. The two are complementary, not mutually exclusive. Perl 6 is
140 not meant to replace Perl 5, and vice versa. See L</"What is Perl 6?"> below
143 See L<perlhist> for a history of Perl revisions.
145 =head2 What is Perl 6?
147 Perl 6 was I<originally> described as the community's rewrite of Perl 5.
148 Development started in 2002; syntax and design work continue to this day.
149 As the language has evolved, it has become clear that it is a separate
150 language, incompatible with Perl 5 but in the same language family.
152 Contrary to popular belief, Perl 6 and Perl 5 peacefully coexist with one
153 another. Perl 6 has proven to be a fascinating source of ideas for those
154 using Perl 5 (the L<Moose> object system is a well-known example). There is
155 overlap in the communities, and this overlap fosters the tradition of sharing
156 and borrowing that have been instrumental to Perl's success. The current
157 leading implementation of Perl 6 is Rakudo, and you can learn more about
158 it at L<http://rakudo.org>.
160 If you want to learn more about Perl 6, or have a desire to help in
161 the crusade to make Perl a better place then read the Perl 6 developers
162 page at L<http://www.perl6.org/> and get involved.
164 "We're really serious about reinventing everything that needs reinventing."
167 =head2 How stable is Perl?
169 Production releases, which incorporate bug fixes and new functionality,
170 are widely tested before release. Since the 5.000 release, we have
171 averaged about one production release per year.
173 The Perl development team occasionally make changes to the
174 internal core of the language, but all possible efforts are made toward
175 backward compatibility.
177 =head2 How often are new versions of Perl released?
179 Recently, the plan has been to release a new version of Perl roughly every
180 April, but getting the release right is more important than sticking rigidly to
181 a calendar date, so the release date is somewhat flexible. The historical
182 release dates can be viewed at L<http://www.cpan.org/src/README.html>.
184 Even numbered minor versions (5.14, 5.16, 5.18) are production versions, and
185 odd numbered minor versions (5.15, 5.17, 5.19) are development versions. Unless
186 you want to try out an experimental feature, you probably never want to install
187 a development version of Perl.
189 The Perl development team are called Perl 5 Porters, and their
190 organization is described at L<http://perldoc.perl.org/perlpolicy.html>.
191 The organizational rules really just boil down to one: Larry is always
192 right, even when he was wrong.
194 =head2 Is Perl difficult to learn?
196 No, Perl is easy to start L<learning|http://learn.perl.org/> --and easy to keep learning. It looks
197 like most programming languages you're likely to have experience
198 with, so if you've ever written a C program, an awk script, a shell
199 script, or even a BASIC program, you're already partway there.
201 Most tasks only require a small subset of the Perl language. One of
202 the guiding mottos for Perl development is "there's more than one way
203 to do it" (TMTOWTDI, sometimes pronounced "tim toady"). Perl's
204 learning curve is therefore shallow (easy to learn) and long (there's
205 a whole lot you can do if you really want).
207 Finally, because Perl is frequently (but not always, and certainly not by
208 definition) an interpreted language, you can write your programs and test
209 them without an intermediate compilation step, allowing you to experiment
210 and test/debug quickly and easily. This ease of experimentation flattens
211 the learning curve even more.
213 Things that make Perl easier to learn: Unix experience, almost any kind
214 of programming experience, an understanding of regular expressions, and
215 the ability to understand other people's code. If there's something you
216 need to do, then it's probably already been done, and a working example is
217 usually available for free. Don't forget Perl modules, either.
218 They're discussed in Part 3 of this FAQ, along with L<CPAN|http://www.cpan.org/>, which is
221 =head2 How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?
223 Perl can be used for almost any coding problem, even ones which require
224 integrating specialist C code for extra speed. As with any tool it can
225 be used well or badly. Perl has many strengths, and a few weaknesses,
226 precisely which areas are good and bad is often a personal choice.
228 When choosing a language you should also be influenced by the
229 L<resources|http://www.cpan.org/>, L<testing culture|http://www.cpantesters.org/>
230 and L<community|http://www.perl.org/community.html> which surrounds it.
232 For comparisons to a specific language it is often best to create
233 a small project in both languages and compare the results, make sure
234 to use all the L<resources|http://www.cpan.org/> of each language,
235 as a language is far more than just it's syntax.
237 =head2 Can I do [task] in Perl?
239 Perl is flexible and extensible enough for you to use on virtually any
240 task, from one-line file-processing tasks to large, elaborate systems.
242 For many people, Perl serves as a great replacement for shell scripting.
243 For others, it serves as a convenient, high-level replacement for most of
244 what they'd program in low-level languages like C or C++. It's ultimately
245 up to you (and possibly your management) which tasks you'll use Perl
246 for and which you won't.
248 If you have a library that provides an API, you can make any component
249 of it available as just another Perl function or variable using a Perl
250 extension written in C or C++ and dynamically linked into your main
251 perl interpreter. You can also go the other direction, and write your
252 main program in C or C++, and then link in some Perl code on the fly,
253 to create a powerful application. See L<perlembed>.
255 That said, there will always be small, focused, special-purpose
256 languages dedicated to a specific problem domain that are simply more
257 convenient for certain kinds of problems. Perl tries to be all things
258 to all people, but nothing special to anyone. Examples of specialized
259 languages that come to mind include prolog and matlab.
261 =head2 When shouldn't I program in Perl?
263 One good reason is when you already have an existing
264 application written in another language that's all done (and done
265 well), or you have an application language specifically designed for a
266 certain task (e.g. prolog, make).
268 If you find that you need to speed up a specific part of a Perl
269 application (not something you often need) you may want to use C,
270 but you can access this from your Perl code with L<perlxs>.
272 =head2 What's the difference between "perl" and "Perl"?
274 "Perl" is the name of the language. Only the "P" is capitalized.
275 The name of the interpreter (the program which runs the Perl script)
276 is "perl" with a lowercase "p".
278 You may or may not choose to follow this usage. But never write "PERL",
279 because perl is not an acronym.
281 =head2 What is a JAPH?
283 (contributed by brian d foy)
285 JAPH stands for "Just another Perl hacker,", which Randal Schwartz used
286 to sign email and usenet messages starting in the late 1980s. He
287 previously used the phrase with many subjects ("Just another x hacker,"),
288 so to distinguish his JAPH, he started to write them as Perl programs:
290 print "Just another Perl hacker,";
292 Other people picked up on this and started to write clever or obfuscated
293 programs to produce the same output, spinning things quickly out of
294 control while still providing hours of amusement for their creators and
297 CPAN has several JAPH programs at L<http://www.cpan.org/misc/japh>.
299 =head2 How can I convince others to use Perl?
301 (contributed by brian d foy)
303 Appeal to their self interest! If Perl is new (and thus scary) to them,
304 find something that Perl can do to solve one of their problems. That
305 might mean that Perl either saves them something (time, headaches, money)
306 or gives them something (flexibility, power, testability).
308 In general, the benefit of a language is closely related to the skill of
309 the people using that language. If you or your team can be faster,
310 better, and stronger through Perl, you'll deliver more value. Remember,
311 people often respond better to what they get out of it. If you run
312 into resistance, figure out what those people get out of the other
313 choice and how Perl might satisfy that requirement.
315 You don't have to worry about finding or paying for Perl; it's freely
316 available and several popular operating systems come with Perl. Community
317 support in places such as Perlmonks ( L<http://www.perlmonks.com> )
318 and the various Perl mailing lists ( L<http://lists.perl.org> ) means that
319 you can usually get quick answers to your problems.
321 Finally, keep in mind that Perl might not be the right tool for every
322 job. You're a much better advocate if your claims are reasonable and
323 grounded in reality. Dogmatically advocating anything tends to make
324 people discount your message. Be honest about possible disadvantages
325 to your choice of Perl since any choice has trade-offs.
327 You might find these links useful:
331 =item * L<http://www.perl.org/about.html>
333 =item * L<http://perltraining.com.au/whyperl.html>
337 =head1 AUTHOR AND COPYRIGHT
339 Copyright (c) 1997-2010 Tom Christiansen, Nathan Torkington, and
340 other authors as noted. All rights reserved.
342 This documentation is free; you can redistribute it and/or modify it
343 under the same terms as Perl itself.
345 Irrespective of its distribution, all code examples here are in the public
346 domain. You are permitted and encouraged to use this code and any
347 derivatives thereof in your own programs for fun or for profit as you
348 see fit. A simple comment in the code giving credit to the FAQ would
349 be courteous but is not required.