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