Friday, June 26, 2009

Perl Ironman

This blog is my entry in the Perl Ironman competition. I had been thinking about it for a while, but MST's lightning talk at YAPC NA pushed me over the edge.

So, what to expect from the content? Well, in addition to any good emails or answers I write, I am planning on a journey through Perl 5's standard library. There is a lot of stuff in there that I have never known about or have forgotten. The realization that I need to take this journey came when I wanted to know the current process's parent's PID. I hit Google and was shocked to find that getppid is a core function.

Perl 6 is also likely to come up from time to time as I play with Rakudo.

Thursday, June 25, 2009

An Email to a Beginner

On Thu, Jun 25, 2009 at 09:23, REDACTED wrote:
> Respected Sir,

Hmm, was this supposed to be directed at me? I am just a geek.

> I am very keen to gather knowledge of perl. I use perl for last six months,
> and I am new to perl. So I need your help and kind suggestion to develop my
> skill in perl.

There is a simple four prong approach:
  • read
  • write
  • ask questions
  • answer questions
You need to read docs, books, blogs, and code.

The docs are available on your system through the perldoc command
(type perldoc perldoc to learn how to use it), but you can also
access of the information online at perldoc.perl.org (core language)
and search.cpan.org (everything under the sun).

Suggested books are
If you do not have a computer science background, you will want to get
a good algorithms book. I have not looked at it in any detail, but I
have heard good things about
but beware, the book was written ten years ago, and Perl has had two
major releases since then. There are many new features to take
advantage of (this advice also applies for Programming Perl).

Read programming blogs, some blogs I read are:
If you have co-workers or friends who are writing Perl code, take a look at it. CPAN is also a good source for code to read.

Just as important as reading is writing. You should be reading a part
of one of the books and then writing code. And I don't just mean the
examples from the book. Play with the concept the book introduced.
See what you can make it do. These don't have useful programs. And
don't worry when you make mistakes, Every programmer makes mistakes.
By making, and learning from, these mistakes now, you will be better
off later.

In addition to playing with the concepts in the books, you should
choose an ambitious project to implement. When I started out with
Perl, I was a DBA/Developer, and I wanted a nice SQL editor. I was
running on Linux at the time and was missing Informix's SQL Editor (it
only ran on MS Windows) and was dissatisfied with dbaccess (their
terminal client). I looked around and found a GUI toolkit (Gtk) that
worked with Perl and a way to connect to the database (DBI) and I just
started trying to make something work. When I finally got something
working, I realized I needed a new feature, and got coding again. And
so the cycle goes. When you run out of ideas, you can always try
reimplementing UNIX commands. There is wealth of programming
information to be gleaned by doing this.

And don't be afraid to ask questions if something confuses you are you
can't get something to work. I suggest two resources: the perl
beginner's list
and Stack Overflow; just remember not to post the
same question to both (it annoys people).

Answering questions is just as important as asking them. If you think
you know the answer, respond to the question. You will probably be
smacked down, but what is worse: thinking you know the answer when you
don't or a little bit of embarrassment? To try to get you over being
afraid of embarrassment, here is an exchange where I was thoroughly
brought to task for being wrong
, and this didn't happen years ago, it
happened this month. The trick is to care more about the information than your pride.

--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.