[ EN | PT ] Why learn Perl? - Por que aprender Perl?

Banner

Perl is a language made in the late 80's, but in use until today in some places, and I came here to bring you the reasons why the Perl language still lives and beginners can still enjoy its features.

Unix and Perl

Perl is available on virtually all modern Linux distros, and even other Unix-based systems such as BSD and Mac OSX, apart from that, like Python, it can be installed on Windows as well. Its portability becomes gigantic with this, and its scripts become almost universal, delivering to almost all devices the same ease.

Community

Perl has massive compatibility, with meetings like YAPC, and a few thousand, maybe millions of contributors around the world. There is no such thing as "feeling alone" while programming: the community is also considered extremely diverse and receptive, even with silly doubts. So, don't be shy, and come be part of the language community.

AWK

AWK is an interpreted procedural language that emerged a decade before Perl. It is used to process text files, such as reading CSV spreadsheets, delivering analyzes and calculations of these data, formatting spreadsheets, correcting text files, performing text searches, among others. All these features were implemented in Perl, and with advantages, such as executing all this with object orientation, regular expressions (now supported by most AWK interpreters), robust frameworks, sending data over the internet, among other facilities. Of course, you can still do the same with Python (or another "modern" language), but, let's face it, being able to do this with a language that supports a greater number of systems (including legacy systems) is a hand in the wheel.

AWK is not useless, and it may be necessary to use it on some legacy system or something, other than that some code is much more readable than Perl code. However, you don't need it if you're good at Perl, as pretty much all of its functionality is already in Perl, so learn Perl.

Extensiveness

Although Perl is not capable of accessing high-level functions, the language is capable of executing executable files for other languages. A C-savvy Perl programmer can snippet the application with C to improve performance or access low-level functionality, and your project will still work.

RegEx

The world's first implementation of RegEx was a library with the same name in C, but it was in Perl that RegEx took shape, and that's where the standard we use to date in most languages, including PHP, Python, Java, JavaScript and many others. Since the language is available on more legacy systems than Python, it might be a good idea to create parts of your code in Perl if you need regular expressions.

Object orientation

The language, even if it is older, still has object orientation and several other features that more modern languages have. Still, I don't think it's a trivial task for a beginner (object orientation with Perl is a bit "strange" for newbies), so at first glance, Perl won't be your first choice, but if one day it is the your only one, you can be sure that the language will not let you down.

Swiss Army Knife from the web

Virtually everything you can do on the internet you can do with Perl, from frameworks for building web pages to scripting applications to get data from a server via SSH. It is not for nothing that they have been called the Swiss Army Knife of the Web since the beginning.

Legacy

Perl has influenced and still influences many modern programming languages such as Ruby, JavaScript, Python, Lua, PHP and many others. It's not just because the language is older that the knowledge acquired with it cannot be used elsewhere, and Perl is living proof of that, using for example its RegEx syntax, which has become a standard in most languages.

Source code

Perl was written using the entire free software philosophy as a foundation. While on the one hand you will always have example codes (seriously, there are more than 100 thousand modules available only on CPAN), on the other hand your scripts allow you to visualize the code source (and a good effort is made to keep it that way). So, if you're thinking about building closed software, maybe Perl isn't your best option, but if you don't mind that, it might be a good choice.

ONE HUNDRED THOUSAND MODULES and more than 30 years of code. Exactly, you didn't read it wrong, for pretty much everything you want to do, there's an example code and a gigantic documentation, as well as a few thousand other repositories on almost every code versioning platform, like GitHub, Gitlab and many others. Basically, there are more examples on the internet than you would be able to read in years of study, you'll never run out of hand with this.

So, let's learn Perl?


Perl é uma linguagem feita no final da década de 80, mas em uso até hoje em alguns lugares, e vim trazer aqui os motivos pelo qual a linguagem Perl ainda vive e iniciantes ainda podem desfrutar de suas funcionalidades.

Unix e Perl

Perl está disponível em praticamente todas as distros Linux modernas, e até outros sistemas baseados em Unix, como BSD e Mac OSX, fora que, assim como Python, pode ser instalado no Windows também. Sua portabilidade se torna gigantesca com isso, e seus scripts se tornam quase universais, entregando a quase todos os dispositivos a mesma facilidade.

Comunidade

Perl possui uma compatibilidade gigantesca, com reuniões como o YAPC, e alguns milhares, talvez milhões de contribuidores ao redor do mundo. Não existe essa de "se sentir sozinho" enquanto programa: a comunidade também é considerada extremamente diversificada e receptiva, mesmo com dúvidas idiotas. Então, não se acanhe, e venha fazer parte da comunidade da linguagem.

AWK

AWK é uma linguagem procedural interpretada que surgiu uma década antes do Perl. Ela serve para processar arquivos de texto, como ler planilhas CSV, entregar análises e cálculos desses dados, formatar planilhas, corrigir arquivos de texto, realizar buscas nos textos, entre outros. Todas essas funcionalidades foram implementadas no Perl, e com vantagens, como executar tudo isso com orientação a objetos, expressões regulares (hoje já suportados pela maioria dos interpretadores AWK), frameworks robustos, envio de dados pela internet, entre outras facilidades. Claro que você ainda pode fazer o mesmo com Python (ou outra linguagem "moderna"), mas, convenhamos, você poder fazer isso com uma linguagem com um suporte a uma quantidade maior de sistemas (incluindo sistemas legados) é uma mão na roda.

AWK não é inútil, e pode ser necessário usar ela em algum sistema legado ou algo do tipo, fora que alguns códigos são muito mais legíveis que códigos em Perl. Entretanto, você não precisa dela se for bom em Perl, já que praticamente todas as funcionalidades dela o Perl já possui, então, aprenda Perl.

Extensividade

Embora Perl não seja capaz de acessar funções de alto nível, a linguagem é capaz de executar arquivos executáveis de outras linguagens. Um programador Perl com conhecimento em C pode fazer trechos da aplicação com C para melhorar o desempenho ou acessar funcionalidades de baixo nível, e, ainda assim, seu projeto vai funcionar.

RegEx

A primeira implementação do RegEx feito no mundo foi uma biblioteca com o mesmo nome em C, mas foi em Perl que o RegEx tomou forma, e é de lá que vem o padrão que usamos até hoje na maioria das linguagens, incluindo PHP, Python, Java, JavaScript e muitas outras. Como a linguagem está disponível em mais sistemas legado que o Python, pode ser uma ideia interessante criar partes do seu código em Perl caso você precise de expressões regulares.

Orientação a Objetos

A linguagem, mesmo que tenha mais idade, ainda possui orientação a objetos e diversas outras funcionalidades que linguagens mais modernas possuem. Ainda assim, creio que não seja uma tarefa trivial para um iniciante (a orientação a objetos com Perl é um pouco "estranha" para novato), então, a primeira vista, Perl não será sua primeira opção, mas, se um dia for a sua única, pode ter certeza que a linguagem não te deixará na mão.

Canivete suíço da web

Praticamente tudo que dá pra fazer na internet você consegue fazer com Perl, desde frameworks para construção de páginas web até aplicações de script para pegar dados de um servidor via SSH. Não é a toa que chamam ela desde o princípio de canivete suíço da web.

Legado

Perl influenciou e ainda influencia diversas linguagens de programação modernas, como Ruby, JavaScript, Python, Lua, PHP e muitas outras. Não é só porque a linguagem é mais antiga que os conhecimentos adquiridos com ela não podem ser utilizados em outros lugares, e Perl é a prova viva disso, usanndo por exemplo sua sintaxe do RegEx, que se tornou um padrão na maioria das linguagens.

Código fonte

Perl foi escrito usando como base toda a filosofia do software livre. Enquanto por um lado você sempre vai ter códigos de exemplo (sério, existem mais de 100 mil módulos disponíveis só na CPAN), por outro lado seus scripts permitem a visualização do código fonte (e é feito um belo esforço para que continue assim). Então, se pensa em construir software fechado, talvez o Perl não seja sua melhor opção, mas, se não se importa com isso, ele pode ser uma boa escolha.

CEM MIL MÓDULOS e mais de 30 anos de código. Exatamente, você não leu errado, para praticamente tudo que você quiser fazer existe um exemplo de código e uma documentação gigantesca, assim como alguns outros milhares de repositórios em quase todas as plataformas de versionamento de código, como GitHub, Gitlab e muitos outros. Basicamente, existem mais exemplos na internet do que você seria capaz de ler em anos de estudo, você nunca vai ficar na mão com isso.

E então, bora aprender Perl?

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center