Perl

From PHP to Perl

In recent months I've been moving away from PHP, a language for which I have developed in for 6 years. I learned it because it was free instead of learning ASP. I made a website for my boyfriend so he could write articles about computer gaming hardware. I interned at a place and did PHP, and then moved to another company doing PHP.

I was pretty content with PHP ... until I saw Ruby first, then made friends with some Perl geeks, realized they weren't all arrogant l33t language snobs and took another look at Perl. Hey, its kind fun! PHP had become boring and Ruby and Perl gave me a new challenge. At first, I only read them thinking "how can I do this in PHP.." and managed to get my company where I did PHP to send me to YAPC. But after a time, I realized I didn't like PHP anymore and I wanted to do Perl or Ruby.

I've written a few articles on CodeSnipers on the differences between Ruby and PHP. I wrote one on datatypes in PHP vs Perl. Click on the Ruby topic on the side to find those articles.

Since I have been coerced into giving a 5 min talk at Perl meeting tonight about this.. Here's some of my thoughts in a blog...

Reason to like PHP?

Perl;

print { open my $out, ">", "pidfile"; $out or die } $$, "\n";

Ruby;

File.open('pidfile', 'w+'){ |fh| fh.puts Process.pid }

I could have used ‘$$’ instead of Process.pid, but I prefer readability

PHP;

file_put_contents( 'pidfile', getmypid() );

Yeah I know, I know but anyway…

This article provided by sitepoint.com.

Perl & HTML Generation

There are probably vast amounts of documentation and tutorials about the Perl CGI Module but readers of this site who are not Perl programmers probably won't go out on a whim and read about this interesting module. Even a PHP programmer might get inspired ...

CGI.pm is a "Simple Common Gateway Interface Class." I'm still learning myself how to use it, so I'll share what I know..

CGI can be used with two types of programming styles, functional and OOP. So far I've only used the functional.

Include the module with

use CGI qw/:standard/;

Here I'm bringing the "standard" set of functions into my scope. From my limited understanding thus far, the qw thingy delcares what to "export" into the local scope. Anyways, thats what I'm going on now until I become reach monkhood and earn my Camel Pin.

As always when learning something new, I start Uber Simple. Inspired by a exercise in Practical Perl Programing, I created a form that will take hourly rate, hours, overtime and spit out the salary.

YAPC - NA 2006

Registration is open for the YAPC: NA 2006 being held in Chicago June 26, 27, and 28th.

Chicago.pm is proud to announce that registration is open for Yet Another Perl Conference North America (YAPC::NA) 2006. The primary conference will occur June 26th through 28th at the Illinois Institute of Technology in Chicago, Illinois. The conference will feature speakers from throughout the Perl community, as well as, keynote addresses from luminaries such as Larry Wall, the creator of Perl, and guest speakers from the broader dynamic languages and open source communities. The full three-day conference costs only $100, but early registrants can take advantage of a 15% discount and attend the conference for only $85. With such a low cost, YAPC is one of the most affordable and accessible technical conferences available today.

In addition to the conference, three open courses will be offered on June 29th and 30th. These courses are taught by some of the most notable Perl instructors: brian d foy, Randal Schwartz, and Damian Conway. The courses will all run simultaneously during the two days after the conference. Conference attendance is not required when signing up for classes, but it is encouraged.

Sharing my cool toys

I was berated the other day by Keith. He told me about PLEAC and I said yeah, I know!! He said no fair you didn't share your cool toys! So for all you remaining coders out there, I'm sharing! Here's a few handy code snippet sites and I'll review for you today.

PLEAC
This site uses the Perl Cookbook as the basis (which has the Perl source freely available) and volunteers rewrite the snippets in other languages where possible. Very handy, if you know one language and wonder how you would do it in another language.

Perl vs. PHP - Datatypes[arrays|lists|hash|map]

I've made a few friends recently who are ultra Perl geeks (Yes, you know who you are. Andy, Liz and Brian!) and they are rubbing off on me. I learned Perl a little bit, about 6 years ago when I first started web programming but I didn't know any Perl programmers so I had nobody to pester with questions. I always said that Perl was cryptic so Perl Elitists could show off their l33t ski11s. But I've found it's not all that bad…

I know PHP so well, that it helps my understanding to compare Perl to php (Don't flame me Perl folks! I'm not promoting one over the other, just comparing and contrasting).