1898184e3Ssthen=head1 NAME
2898184e3Ssthen
3898184e3Ssthenperlfaq1 - General Questions About Perl
4898184e3Ssthen
5b8851fccSafresh1=head1 VERSION
6b8851fccSafresh1
7*3d61058aSafresh1version 5.20240218
8b8851fccSafresh1
9898184e3Ssthen=head1 DESCRIPTION
10898184e3Ssthen
11898184e3SsthenThis section of the FAQ answers very general, high-level questions
12898184e3Ssthenabout Perl.
13898184e3Ssthen
14898184e3Ssthen=head2 What is Perl?
15898184e3Ssthen
16898184e3SsthenPerl is a high-level programming language with an eclectic heritage
17898184e3Ssthenwritten by Larry Wall and a cast of thousands.
18898184e3Ssthen
19898184e3SsthenPerl's process, file, and text manipulation facilities make it
20898184e3Ssthenparticularly well-suited for tasks involving quick prototyping, system
21898184e3Ssthenutilities, software tools, system management tasks, database access,
22898184e3Ssthengraphical programming, networking, and web programming.
23898184e3Ssthen
24898184e3SsthenPerl derives from the ubiquitous C programming language and to a
25898184e3Ssthenlesser extent from sed, awk, the Unix shell, and many other tools
26898184e3Ssthenand languages.
27898184e3Ssthen
28898184e3SsthenThese strengths make it especially popular with web developers
29898184e3Ssthenand system administrators. Mathematicians, geneticists, journalists,
30898184e3Ssthenmanagers and many other people also use Perl.
31898184e3Ssthen
32898184e3Ssthen=head2 Who supports Perl? Who develops it? Why is it free?
33898184e3Ssthen
34898184e3SsthenThe original culture of the pre-populist Internet and the deeply-held
35898184e3Ssthenbeliefs of Perl's author, Larry Wall, gave rise to the free and open
36898184e3Ssthendistribution policy of Perl. Perl is supported by its users. The
37898184e3Ssthencore, the standard Perl library, the optional modules, and the
38898184e3Ssthendocumentation you're reading now were all written by volunteers.
39898184e3Ssthen
40898184e3SsthenThe core development team (known as the Perl Porters)
41898184e3Ssthenare a group of highly altruistic individuals committed to
42898184e3Ssthenproducing better software for free than you could hope to purchase for
43898184e3Ssthenmoney. You may snoop on pending developments via the
44898184e3SsthenL<archives|http://www.nntp.perl.org/group/perl.perl5.porters/>
45898184e3Ssthenor you can subscribe to the mailing list by sending
46898184e3Ssthenperl5-porters-subscribe@perl.org a subscription request
47898184e3Ssthen(an empty message with no subject is fine).
48898184e3Ssthen
49898184e3SsthenWhile the GNU project includes Perl in its distributions, there's no
50898184e3Ssthensuch thing as "GNU Perl". Perl is not produced nor maintained by the
51898184e3SsthenFree Software Foundation. Perl's licensing terms are also more open
52898184e3Ssthenthan GNU software's tend to be.
53898184e3Ssthen
54898184e3SsthenYou can get commercial support of Perl if you wish, although for most
55898184e3Ssthenusers the informal support will more than suffice. See the answer to
56898184e3Ssthen"Where can I buy a commercial version of Perl?" for more information.
57898184e3Ssthen
58898184e3Ssthen=head2 Which version of Perl should I use?
59898184e3Ssthen
60b46d8ef2Safresh1(contributed by brian d foy with updates from others)
61898184e3Ssthen
62898184e3SsthenThere is often a matter of opinion and taste, and there isn't any one
63898184e3Ssthenanswer that fits everyone. In general, you want to use either the current
64898184e3Ssthenstable release, or the stable release immediately prior to that one.
65898184e3Ssthen
66898184e3SsthenBeyond that, you have to consider several things and decide which is best
67898184e3Ssthenfor you.
68898184e3Ssthen
69898184e3Ssthen=over 4
70898184e3Ssthen
71898184e3Ssthen=item *
72898184e3Ssthen
73898184e3SsthenIf things aren't broken, upgrading perl may break them (or at least issue
74898184e3Ssthennew warnings).
75898184e3Ssthen
76898184e3Ssthen=item *
77898184e3Ssthen
78898184e3SsthenThe latest versions of perl have more bug fixes.
79898184e3Ssthen
80898184e3Ssthen=item *
81898184e3Ssthen
82b46d8ef2Safresh1The latest versions of perl may contain performance improvements and
83b46d8ef2Safresh1features not present in older versions.  There have been many changes
84b46d8ef2Safresh1in perl since perl5 was first introduced.
85b46d8ef2Safresh1
86b46d8ef2Safresh1=item *
87b46d8ef2Safresh1
88898184e3SsthenThe Perl community is geared toward supporting the most recent releases,
89898184e3Ssthenso you'll have an easier time finding help for those.
90898184e3Ssthen
91898184e3Ssthen=item *
92898184e3Ssthen
93b46d8ef2Safresh1Older versions of perl may have security vulnerabilities, some of which
94b46d8ef2Safresh1are serious (see L<perlsec> and search
95b46d8ef2Safresh1L<CVEs|https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=Perl> for more
96b46d8ef2Safresh1information).
97898184e3Ssthen
98898184e3Ssthen=item *
99898184e3Ssthen
100898184e3SsthenThe latest versions are probably the least deployed and widely tested, so
101898184e3Ssthenyou may want to wait a few months after their release and see what
102898184e3Ssthenproblems others have if you are risk averse.
103898184e3Ssthen
104898184e3Ssthen=item *
105898184e3Ssthen
106b46d8ef2Safresh1The immediate, in addition to the current stable release, the previous
107b46d8ef2Safresh1stable release is maintained.  See
108b46d8ef2Safresh1L<perlpolicy/"MAINTENANCE AND SUPPORT"> for more information.
109898184e3Ssthen
110898184e3Ssthen=item *
111898184e3Ssthen
112898184e3SsthenThere are really two tracks of perl development: a maintenance version
113898184e3Ssthenand an experimental version. The maintenance versions are stable, and
114b46d8ef2Safresh1have an even number as the minor release (i.e. perl5.24.x, where 24 is the
115898184e3Ssthenminor release). The experimental versions may include features that
116898184e3Ssthendon't make it into the stable versions, and have an odd number as the
117b46d8ef2Safresh1minor release (i.e. perl5.25.x, where 25 is the minor release).
118b46d8ef2Safresh1
119b46d8ef2Safresh1=item *
120b46d8ef2Safresh1
121b46d8ef2Safresh1You can consult L<releases|http://dev.perl.org/perl5> to determine the
122b46d8ef2Safresh1current stable release of Perl.
123898184e3Ssthen
124898184e3Ssthen=back
125898184e3Ssthen
12656d68f1eSafresh1=head2 What is Raku (Perl 6)?
127898184e3Ssthen
12856d68f1eSafresh1Raku (formerly known as Perl 6) was I<originally> described as the community's
12956d68f1eSafresh1rewrite of Perl, however as the language evolved, it became clear that it is
13056d68f1eSafresh1a separate language, but in the same language family as Perl.
1319f11ffb7Safresh1
13256d68f1eSafresh1Raku is not intended primarily as a replacement for Perl, but as its
13356d68f1eSafresh1own thing - and libraries exist to allow you to call Perl code from Raku
13456d68f1eSafresh1programs and vice versa.
135898184e3Ssthen
13656d68f1eSafresh1Contrary to popular belief, Raku and Perl peacefully coexist with one
13756d68f1eSafresh1another. Raku has proven to be a fascinating source of ideas for those
13856d68f1eSafresh1using Perl (the L<Moose> object system is a well-known example). There is
139898184e3Ssthenoverlap in the communities, and this overlap fosters the tradition of sharing
1409f11ffb7Safresh1and borrowing that have been instrumental to Perl's success.
141898184e3Ssthen
14256d68f1eSafresh1For more about Raku see L<https://www.raku.org/>.
143898184e3Ssthen
144898184e3Ssthen"We're really serious about reinventing everything that needs reinventing."
145898184e3Ssthen--Larry Wall
146898184e3Ssthen
147898184e3Ssthen=head2 How stable is Perl?
148898184e3Ssthen
149898184e3SsthenProduction releases, which incorporate bug fixes and new functionality,
150898184e3Ssthenare widely tested before release. Since the 5.000 release, we have
151898184e3Ssthenaveraged about one production release per year.
152898184e3Ssthen
153898184e3SsthenThe Perl development team occasionally make changes to the
154898184e3Sstheninternal core of the language, but all possible efforts are made toward
155898184e3Ssthenbackward compatibility.
156898184e3Ssthen
1576fb12b70Safresh1=head2 How often are new versions of Perl released?
1586fb12b70Safresh1
1596fb12b70Safresh1Recently, the plan has been to release a new version of Perl roughly every
1606fb12b70Safresh1April, but getting the release right is more important than sticking rigidly to
1616fb12b70Safresh1a calendar date, so the release date is somewhat flexible.  The historical
1626fb12b70Safresh1release dates can be viewed at L<http://www.cpan.org/src/README.html>.
1636fb12b70Safresh1
1646fb12b70Safresh1Even numbered minor versions (5.14, 5.16, 5.18) are production versions, and
1656fb12b70Safresh1odd numbered minor versions (5.15, 5.17, 5.19) are development versions. Unless
1666fb12b70Safresh1you want to try out an experimental feature, you probably never want to install
1676fb12b70Safresh1a development version of Perl.
1686fb12b70Safresh1
1696fb12b70Safresh1The Perl development team are called Perl 5 Porters, and their
1706fb12b70Safresh1organization is described at L<http://perldoc.perl.org/perlpolicy.html>.
1716fb12b70Safresh1The organizational rules really just boil down to one: Larry is always
1726fb12b70Safresh1right, even when he was wrong.
1736fb12b70Safresh1
174898184e3Ssthen=head2 Is Perl difficult to learn?
175898184e3Ssthen
176898184e3SsthenNo, Perl is easy to start L<learning|http://learn.perl.org/> --and easy to keep learning. It looks
177898184e3Ssthenlike most programming languages you're likely to have experience
178898184e3Ssthenwith, so if you've ever written a C program, an awk script, a shell
179898184e3Ssthenscript, or even a BASIC program, you're already partway there.
180898184e3Ssthen
181898184e3SsthenMost tasks only require a small subset of the Perl language. One of
182898184e3Ssthenthe guiding mottos for Perl development is "there's more than one way
183898184e3Ssthento do it" (TMTOWTDI, sometimes pronounced "tim toady"). Perl's
184898184e3Ssthenlearning curve is therefore shallow (easy to learn) and long (there's
185898184e3Ssthena whole lot you can do if you really want).
186898184e3Ssthen
187898184e3SsthenFinally, because Perl is frequently (but not always, and certainly not by
188898184e3Ssthendefinition) an interpreted language, you can write your programs and test
189898184e3Ssthenthem without an intermediate compilation step, allowing you to experiment
190898184e3Ssthenand test/debug quickly and easily. This ease of experimentation flattens
191898184e3Ssthenthe learning curve even more.
192898184e3Ssthen
193898184e3SsthenThings that make Perl easier to learn: Unix experience, almost any kind
194898184e3Ssthenof programming experience, an understanding of regular expressions, and
195898184e3Ssthenthe ability to understand other people's code. If there's something you
196898184e3Ssthenneed to do, then it's probably already been done, and a working example is
197898184e3Ssthenusually available for free. Don't forget Perl modules, either.
198898184e3SsthenThey're discussed in Part 3 of this FAQ, along with L<CPAN|http://www.cpan.org/>, which is
199898184e3Ssthendiscussed in Part 2.
200898184e3Ssthen
201898184e3Ssthen=head2 How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?
202898184e3Ssthen
203898184e3SsthenPerl can be used for almost any coding problem, even ones which require
204898184e3Ssthenintegrating specialist C code for extra speed. As with any tool it can
205898184e3Ssthenbe used well or badly. Perl has many strengths, and a few weaknesses,
206898184e3Ssthenprecisely which areas are good and bad is often a personal choice.
207898184e3Ssthen
208898184e3SsthenWhen choosing a language you should also be influenced by the
209898184e3SsthenL<resources|http://www.cpan.org/>, L<testing culture|http://www.cpantesters.org/>
210898184e3Ssthenand L<community|http://www.perl.org/community.html> which surrounds it.
211898184e3Ssthen
212898184e3SsthenFor comparisons to a specific language it is often best to create
213898184e3Ssthena small project in both languages and compare the results, make sure
214898184e3Ssthento use all the L<resources|http://www.cpan.org/> of each language,
215898184e3Ssthenas a language is far more than just it's syntax.
216898184e3Ssthen
217898184e3Ssthen=head2 Can I do [task] in Perl?
218898184e3Ssthen
219898184e3SsthenPerl is flexible and extensible enough for you to use on virtually any
220898184e3Ssthentask, from one-line file-processing tasks to large, elaborate systems.
221898184e3Ssthen
222898184e3SsthenFor many people, Perl serves as a great replacement for shell scripting.
223898184e3SsthenFor others, it serves as a convenient, high-level replacement for most of
224898184e3Ssthenwhat they'd program in low-level languages like C or C++. It's ultimately
225898184e3Ssthenup to you (and possibly your management) which tasks you'll use Perl
226898184e3Ssthenfor and which you won't.
227898184e3Ssthen
228898184e3SsthenIf you have a library that provides an API, you can make any component
229898184e3Ssthenof it available as just another Perl function or variable using a Perl
230898184e3Ssthenextension written in C or C++ and dynamically linked into your main
231898184e3Ssthenperl interpreter. You can also go the other direction, and write your
232898184e3Ssthenmain program in C or C++, and then link in some Perl code on the fly,
233898184e3Ssthento create a powerful application. See L<perlembed>.
234898184e3Ssthen
235898184e3SsthenThat said, there will always be small, focused, special-purpose
236898184e3Ssthenlanguages dedicated to a specific problem domain that are simply more
237898184e3Ssthenconvenient for certain kinds of problems. Perl tries to be all things
238898184e3Ssthento all people, but nothing special to anyone. Examples of specialized
239898184e3Ssthenlanguages that come to mind include prolog and matlab.
240898184e3Ssthen
241898184e3Ssthen=head2 When shouldn't I program in Perl?
242898184e3Ssthen
243898184e3SsthenOne good reason is when you already have an existing
244898184e3Ssthenapplication written in another language that's all done (and done
245898184e3Ssthenwell), or you have an application language specifically designed for a
246898184e3Ssthencertain task (e.g. prolog, make).
247898184e3Ssthen
248898184e3SsthenIf you find that you need to speed up a specific part of a Perl
249898184e3Ssthenapplication (not something you often need) you may want to use C,
250898184e3Ssthenbut you can access this from your Perl code with L<perlxs>.
251898184e3Ssthen
252898184e3Ssthen=head2 What's the difference between "perl" and "Perl"?
253898184e3Ssthen
254898184e3Ssthen"Perl" is the name of the language. Only the "P" is capitalized.
255898184e3SsthenThe name of the interpreter (the program which runs the Perl script)
256898184e3Ssthenis "perl" with a lowercase "p".
257898184e3Ssthen
258898184e3SsthenYou may or may not choose to follow this usage. But never write "PERL",
259898184e3Ssthenbecause perl is not an acronym.
260898184e3Ssthen
261898184e3Ssthen=head2 What is a JAPH?
262898184e3Ssthen
263898184e3Ssthen(contributed by brian d foy)
264898184e3Ssthen
265898184e3SsthenJAPH stands for "Just another Perl hacker,", which Randal Schwartz used
266898184e3Ssthento sign email and usenet messages starting in the late 1980s. He
267898184e3Ssthenpreviously used the phrase with many subjects ("Just another x hacker,"),
268898184e3Ssthenso to distinguish his JAPH, he started to write them as Perl programs:
269898184e3Ssthen
270898184e3Ssthen    print "Just another Perl hacker,";
271898184e3Ssthen
272898184e3SsthenOther people picked up on this and started to write clever or obfuscated
273898184e3Ssthenprograms to produce the same output, spinning things quickly out of
274898184e3Ssthencontrol while still providing hours of amusement for their creators and
275898184e3Ssthenreaders.
276898184e3Ssthen
277898184e3SsthenCPAN has several JAPH programs at L<http://www.cpan.org/misc/japh>.
278898184e3Ssthen
279898184e3Ssthen=head2 How can I convince others to use Perl?
280898184e3Ssthen
281898184e3Ssthen(contributed by brian d foy)
282898184e3Ssthen
283898184e3SsthenAppeal to their self interest! If Perl is new (and thus scary) to them,
284898184e3Ssthenfind something that Perl can do to solve one of their problems. That
285898184e3Ssthenmight mean that Perl either saves them something (time, headaches, money)
286898184e3Ssthenor gives them something (flexibility, power, testability).
287898184e3Ssthen
288898184e3SsthenIn general, the benefit of a language is closely related to the skill of
289898184e3Ssthenthe people using that language. If you or your team can be faster,
290898184e3Ssthenbetter, and stronger through Perl, you'll deliver more value. Remember,
291898184e3Ssthenpeople often respond better to what they get out of it. If you run
292898184e3Sstheninto resistance, figure out what those people get out of the other
293898184e3Ssthenchoice and how Perl might satisfy that requirement.
294898184e3Ssthen
295898184e3SsthenYou don't have to worry about finding or paying for Perl; it's freely
296898184e3Ssthenavailable and several popular operating systems come with Perl. Community
297898184e3Ssthensupport in places such as Perlmonks ( L<http://www.perlmonks.com> )
298898184e3Ssthenand the various Perl mailing lists ( L<http://lists.perl.org> ) means that
299898184e3Ssthenyou can usually get quick answers to your problems.
300898184e3Ssthen
301898184e3SsthenFinally, keep in mind that Perl might not be the right tool for every
302898184e3Ssthenjob. You're a much better advocate if your claims are reasonable and
303898184e3Ssthengrounded in reality. Dogmatically advocating anything tends to make
304898184e3Ssthenpeople discount your message. Be honest about possible disadvantages
305898184e3Ssthento your choice of Perl since any choice has trade-offs.
306898184e3Ssthen
307898184e3SsthenYou might find these links useful:
308898184e3Ssthen
309898184e3Ssthen=over 4
310898184e3Ssthen
311898184e3Ssthen=item * L<http://www.perl.org/about.html>
312898184e3Ssthen
313898184e3Ssthen=item * L<http://perltraining.com.au/whyperl.html>
314898184e3Ssthen
315898184e3Ssthen=back
316898184e3Ssthen
317898184e3Ssthen=head1 AUTHOR AND COPYRIGHT
318898184e3Ssthen
319898184e3SsthenCopyright (c) 1997-2010 Tom Christiansen, Nathan Torkington, and
320898184e3Ssthenother authors as noted. All rights reserved.
321898184e3Ssthen
322898184e3SsthenThis documentation is free; you can redistribute it and/or modify it
323898184e3Ssthenunder the same terms as Perl itself.
324898184e3Ssthen
325898184e3SsthenIrrespective of its distribution, all code examples here are in the public
326898184e3Ssthendomain. You are permitted and encouraged to use this code and any
327898184e3Ssthenderivatives thereof in your own programs for fun or for profit as you
328898184e3Ssthensee fit. A simple comment in the code giving credit to the FAQ would
329898184e3Ssthenbe courteous but is not required.
330