Gabor Szabo Perl Trainer

Perl on the command line

While most of the tutorial deals with scripts saved in a file we'll also see a couple of examples for one-liners.

Even if you are using Padre or some other IDE that would let you run your script from the editor itself it is very important to familiarize yourself with the command line (or shell) and be able to use perl from there.

See the full article


TODO February 2012

In January I started to write annual and monthly reports and TODO lists. On one hand, I hope that this will help me track my progress and on the other hand it lets you, my reader, take a look at my plans and participate in the journey.

Excuses

January was a short but busy month as I was on skiing vacation with my children for 10 days. Luckily the owners of the B&B (Zimmer) had installed wifi so I could at least handle some of my e-mails and I could post the Perl Weekly.

See the full article


The right way to install CPAN modules

There are several ways to install CPAN modules and about everyone advocates something else.

You can install the modules supplied by your vendor (e.g. using aptitude on Debian). If the module is not available from the vendor you can prepare a package (in the case of Debian using dh-make-perl) or you can install the modules using a CPAN client. In that case you can do it to the standard system directories or using local::lib.

See the full article


Global symbol requires explicit package name

Global symbol requires explicit package name is a common, and IMHO very misleading error message of Perl. At least for beginners.

The quick translation is "You need to declare the variable using my."

The simplest example


  use strict;
  use warnings;

  $x = 42;

And the error is

See the full article


Use of uninitialized value

A lot of people consider the errors and warnings of Perl to be great. Usually that's true but in my experience, they can be very confusing to people who are not yet familiar with Perl. I'll describe some of them.

Quick explanation


  Use of uninitialized value $x in say at perl_warning_1.pl line 6.

This means the variable $x has no value (its value is undef). Either it never got a value or something assigned an undef value to it.

See the full article