PERL (Practical Extraction and Reporting Language)

From JaxHax
Jump to navigation Jump to search

Introduction

PERL is a high-level interpreted programming language created by Larry Wall in 1987. It is an interpreted language meaning you just write the code but do not have to compile it into a binary, instead you will use an interpreter engine (in this case, perl) which will read your script and convert it into machine code at runtime. PERL scripts are typically saved with the file extension "pl". This is an older language but due to that fact it is a very mature language with a heavily documented community and tons of modules (basically libraries) stored in the CPAN repository. Another good thing about the age of this language and it's popularity is that if you have linux, you likely already have it installed (you may check in a terminal by typing "perl -v" to get the version) as this was expected to be there by most linux people. If you are on windows then a company called ActiveState has the PERL for Windows interpreter available for free of charge; just download it and install it.


PERL is still since heavily used in the real world in production environments running custom written CGI scripts and cron jobs. That said it is probably not a bad idea to know this language, aside from making yourself more valuable for being able to support legacy code where ever life takes, PERL can also enable you to create very useful tools on the fly with a great example being a one-time odd-ball report that needs to be run; PERL shines in this department. It also used to be a favorite for security developers to create hacking tools (in fact, Metasploit was originally written in PERL before it was switch over to RUBY years later) and proof of concept exploits with ease. The first steps will be to get the basics down but once you've learned PERL you will find it is a powerful tool to have in your kit, even with it's age. Remember that PERL was originally designed for data extraction and reporting which means that you can have it pull data from just about anywhere, process it, and re-present it in almost any way you want.


Download of All Example Code

Coming Soon...


Tutorial Lessons

  1. hello.pl - A simple "Hello World" Example in PERL.
  2. variables.pl - A simple example to show how to use variables in PERL.
  3. reading_user_input.pl - An example to show how to prompt a user for input and feed it into a variable.
  4. arrays_and_hashes.pl - An example to introduce how to use arrays and hashes.
  5. getting_script_arguments.pl - An example that shows how to fetch arguments that the user provided via the terminal.
  6. if_statments.pl - An example into using if statements to dynamically control logic flow of our programs.
  7. for_loops.pl - An example on how to use for loops in perl.
  8. number_guessing_game.pl - This example builds a bit more of a real world example using the previous lessons.
  9. intro_to_using_the_IO_NET_lib_for_TCP.pl - This example shows how to use the IO_NET library for TCP.