Learning Perl

Hackers don’t speak 1337. Hell, they don’t even speak newspeak. No sir, they speak Perl and it’s for a very simple reason. Perl, also known as Practical extraction and report language or Pragmatically eclectic rubbish lister, whatever suits you the most, is also credited to be “The Swiss-Army chainsaw of programming languages”, according to Wikipedia.

By Randall Munroe, from XKCD

Yes. XKCD backs that up.

Perl was originally designed to fulfill the role of text tools such as awk and grep, as Larry Wall needed a scripting language that could be easierly handled than Shell-scripting plus text handler tools. Actually, Perl does wonders as a parser.

There are a number of quite interesting features. Even though it is an interpreted language after the compilation, loading and execution on a single script, exec operations can be called in a very simple way, with redirection and everything. Built in.

But parsing is not about just the only thing that can be done with it. Perl is extensively abused by both white and black hat hackers, sniffers, crackers and everyone else around.

The exec feature of Perl is both a very nice feature and a very dangerous one. As uncle Ben once sated, “A great power comes with great responsibility”. After a vulnerability has been found, the shiny exec will let the attacker do pretty much anything wanted that can be accomplished in the target. Let’s say, handling a database’s information, shutting down the target, access and de-encryption of passwords…

Or requesting a shell…

No, I’m not a terrorist. I’m not a hacker. I’m not a cracker or else, I’m just a tech-lover learning Perl.

Handling a language such as Perl is a skill i find interesting and useful. Perhaps the most interesting thing of it, is that Perl is featured inside ‘P’ of the XAMP style server.

The reason is simple. Perl works better as a glue than a Pritt stick does, or a Ctrl/Cmd + V. Linking together applications that are just not meant to communicate is one of the reasons that won Perl a nice place in the XAMP stack.

I’m really enjoying learning it. Though I’m not a big fan (which could be better said as “I just hate”) of dynamic languages, Perl’s variables are quite fancy. They’re just infinite.

Yes, you got it right. They’re infinite. There’s no variable size in Perl. if you have a string, it can be the size of the systems’ available memory. Actually, a single string variable can hold this entire post.

Don’t buy it? Try it for yourself. Just copy from the she-bang (#!/usr/bin/perl) to the print call in an editor and run it using:

perl (name)

or execute it directly:

chmod 755 (name)
./(name)

Note: If you don’t have Perl already installed, or if you’re on a Windows system without Perl, you can always use the so handy lleval.