Skip to content

Commit fdd6e26

Browse files
kspalaiologosjonasgeiler
authored andcommitted
Perl (#59)
* Create README.md * Create conclusion.md * Create disadvantages.md * Create history.md * Create intro.md * Create misc.md * Update README.md * Create advantages.md * Update advantages.md * Update advantages.md * Update disadvantages.md * Update advantages.md * Update disadvantages.md * Update history.md * Update intro.md * We will say NO to misc.md * Update conclusion.md * Update conclusion.md * Update intro.md * Update history.md * Update advantages.md * Update conclusion.md * Update disadvantages.md * Update history.md * Update intro.md
1 parent beb4095 commit fdd6e26

6 files changed

Lines changed: 93 additions & 0 deletions

File tree

book/languages/perl/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Welcome
2+
3+
> This chapter has been authored by Krzysztof Szewczyk "Παλαιολόγος".
4+
5+
Welcome to the Perl chapter! I'd like to let you know a bit more about this famous language.

book/languages/perl/advantages.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Advantages
2+
3+
Perl derives most of its syntax from well-known languages and tools common in UNIX-like operating systems.
4+
5+
Becoming a good programmer with Perl, with previous knowledge of C, Shell script, Sed, Awk and other UNIX tools
6+
is relatively easy. Perl is **really** easy to learn!
7+
8+
Perl with CPAN has a module to do pretty much anything you'd ever want to do and even more for things you
9+
probably don't want to do.
10+
11+
Perl is a very entraining language to work (like C or Assembly) because of the freedom it provides.
12+
13+
Perl is stable and predictable - it just requires basic UNIX knowledge and decent Perl intuition.
14+
15+
Finally, Perl has developed text processing capabilities to the extreme - You want to strip newlines from input? Check it out:
16+
17+
```pl
18+
$_ = do { local $/; <> };
19+
s/[\n\r\t ]+//g;
20+
print;
21+
```
22+
23+
As you can see, it's pretty simple and compact!

book/languages/perl/conclusion.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Conclusion
3+
4+
Perl is amazing text processing language and there is no other tool that can beat Perl in this discipline.
5+
6+
Perl is very definite. As a simple example, let's check out the classic "Hello World" program. Here it is in C:
7+
8+
```c
9+
int main(void) {
10+
printf("Hello World!\n");
11+
}
12+
```
13+
14+
And here it is in Perl:
15+
16+
```pl
17+
print 'Hello World!';
18+
```
19+
20+
Get in, get out, while getting the job done. Whenever you need help with Perl, you can always
21+
check welcoming community of comp.lang.perl.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
# Disadvantages
3+
4+
The language has a bad reputation because of the "write only" way code can be produced in it, but, to be honest, you can write
5+
obfuscated code in all languages, some make it more difficult (Assembly, Java), some make it less difficult (JavaScript, Perl).
6+
7+
Perl is easy to write, hard to write well. You will need a lot of experience to write good Perl code.
8+
9+
Perl isn't geared for User Interfaces. To this day I can't figure a simple way to create UI.
10+
11+
If you did years of Linux, bash, C, sed, awk, etc., for you Perl may seem intuitive. But if you came from Windows, and you don't
12+
have enough UNIX experience, a lot of the "intuitive" stuff probably looks totally insane. If you were forced to maintain such
13+
"write-only" code, you'd be probably angry.
14+
15+
Finally, using prefixes like $, @ and % on identifiers isn't a good way to express your type system. Sigils are coming from
16+
BASIC-like languages. Ideas that BASIC initiated in general aren't very good practices today.

book/languages/perl/history.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# History
3+
4+
Larry Wall developed Perl in 1986. He was a systems programmer on a project that was developing multilevel, secure wide area
5+
networks. Larry was in charge of installation. Larry's primary job was system support "guru". During this stint, he developed
6+
several useful UNIX tools such as rn, patch, and warp. Perl was developed in response to a management requirement for a
7+
configuration management and control system. Larry's manager asked him to produce reports. Larry's first thought was to use awk to
8+
produce the reports. Awk couldn't handle opening and closing multiple files based on information in the files. Larry didn't want to
9+
code a special purpose tool just for this job, so a new language was born. You'll find a reference to the former five-letter
10+
version in the entry for the acronym Practical Extraction and Report Language. The manual page was only 15 pages long. But Perl was
11+
faster than sed and awk and began to be used on other aspects of the project. Larry moved on to support research and development
12+
and took Perl with him. Perl was becoming a good tool for system administration. Larry borrowed Henry Spencer's regular expression
13+
package and modified it for Perl. Then Larry added most of the goodies he and other people wanted and released it on the Internet.

book/languages/perl/intro.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
# Introduction
3+
4+
Perl is an interpreted language optimized for processing arbitrary text files, extracting information, and printing reports.
5+
It is also a good language for system management tasks. The language is intended to be practical, easy to use, efficient, and
6+
complete, rather than beautiful-tiny, elegant, and minimal. Perl was written by Larry Wall, with help of other contributors.
7+
8+
Perl is bundled with various Linux distros and other UNIX-like systems. You can install it on Windows (R).
9+
10+
Perl is interpreted. This can be either an advantage or disadvantage, depending on your needs. For example, Perl has a short
11+
development cycle compared to compiled languages, but it will never reach their efficiency.
12+
13+
Perl is written to be practical. This means that it's complete, easy to use and relatively efficient.
14+
15+
Let's dive into Perl' history!

0 commit comments

Comments
 (0)