Thursday, March 24, 2005

Perl ‘la la’ Land…Literally

I believe I’m actually uncovering a parallel universe.

I’m starting to believe that Perl is actually a village in an alternative universe where everyone is a Monk that walks around one foot-in-front-of-the-other speaking in their native language, Glorious Nonsense.

I haven’t touched Perl in two years. I never quite got the hang of it before, but I could say ‘hey’ to the world in more ways than most people can. There’s a lot more call for it in my new employment (yes, I have a day job), which is exciting. When Delicioso found out that I was a computer nerd, he had his friend Tom Christiansen, author of my fav Perl book, The Perl Cookbook, send me a copy.

Learning a programming language really is learning a different way to think. Not only are you learning new symbols (two dollar signs $$ put together will actually tell you the number, or id, of the program, or process, you are running) and new meanings to words (chop() will actually “karate chop” off the last character of a word and hand it to you a plate), but you have to learn to only think one step-at-a-time or you’ll trip and fall flat on your face. Then you’ll get really pissed and frustrated because you can’t figure out why. So programming nerds who know how to communicate with the rest of the world have found lots of colorful ways to translate what it is we are doing while we are looking into cyber space all day long… and why we are a little bit insane because of it. But because we are computer nerds (and of the ‘higher mind’ -- ahem), we also have to entertain ourselves (or keep some VERY dry material entertaining) by adding little jokes and innuendos that only other computer nerds can see. A perfect example of me entertaining myself while I’m entertaining you is my binary babydoll T-shirt*.

Here’s how Tom explains hashes to me.


‘People and parts of computer programs interact all sorts of ways. Single scalar** variables are like hermits, living a solitary existence whose only meaning comes from within the individual. Arrays are like cults, where multitudes marshal themselves under the name of a charismatic leader. In the middle lies the comfortable, intimate ground of the one-to-one relationship that is the hash.’

Also to explain my point, some comments by Larry Wall, the dude who invented Perl.

Doing linear scans over a hash is like trying to club someone to death with a loaded Uzi.

So after a while() of translating that this:

while (<>) {
for $chunk (split) {
print (“chunk\n”);
}
}


… allows you to do print every word in a file, you actually start to become a little … kooky.

Perl is not the only village in the Universe. There’s also the Linuxtown, where people write commands that do things that are totally off the beaten path. Example, I found a command called ‘ddate’ when I accidentally typed ‘d’ twice. Here’s snippets of the help (manual) pages for this command.

$ man ddate
DDATE(1) Emperor Norton Utilities DDATE(1)
ddate - converts Gregorian dates to Discordian dates

Arguments (or what each symbol does when you type it)
%H Name of current Holyday, if any

%N Magic code to prevent rest of format from being printed unless
today is a Holyday.
%X Number of days remaining until X-Day. (Not valid if the SubGe-
nius options are not compiled in.)

%{

%} Used to enclose the part of the string which is to be replaced
with the words "St. Tibâs Day" if the current day is St. Tibâs
Day.

%. Try it and see.


% ddate
Sweetmorn, Bureaucracy 42, 3161 YOLD

% ddate +âToday is %{%A, the %e of %B%}, %Y. %N%nCelebrate %Hâ
Today is Sweetmorn, the 42nd of Bureaucracy, 3161.

% ddate +"Itâs %{%A, the %e of %B%}, %Y. %N%nCelebrate %H" 26 9 1995
Itâs Prickle-Prickle, the 50th of Bureaucracy, 3161.
Celebrate Bureflux

% ddate +âTodayâs %{%A, the %e of %B%}, %Y. %N%nCelebrate %Hâ 29 2 1996
Todayâs St. Tibâs Day, 3162.

BUGS
ddate(1) will produce undefined behaviour if asked to produce the date
for St. Tibâs day and its format string does not contain the St. Tibâs
Day delimiters %{ and %}.

NOTE
After âX-Dayâ passed without incident, the Church of the SubGenius
declared that it had got the year upside down - X-Day is actually in
8661 AD rather than 1998 AD. Thus, the True X-Day is Cfn 40, 9827.

AUTHOR
Original program by Druel the Chaotic aka Jeremy Johnson
(mpython@gnu.ai.mit.edu)
Major rewrite by Lee H:. O:. Smith, KYTP, aka Andrew Bulhak
(acb@dev.null.org)
Five tons of flax.

DISTRIBUTION POLICY
Public domain. All rites reversed.

SEE ALSO
date(1),
http://www.subgenius.com/
Malaclypse the Younger, Principia Discordia, Or How I Found Goddess And
What I Did To Her When I Found Her


I thought there were a lot of drugs in the Entertainment world, but apparently they are running around rampant on Planet Geekdom as well. Cheers.

*Thank you ThinkGeek for putting out girl-cut t-shirts a few years ago. You rock!
**My, that’s a scary word!