Hello, you are not signed on.
[ Blogs.starwars.com ]

The Wroshyr Tree
date posted: Apr 25, 2006 8:09 PM  |  updated: Jun 19, 2006 10:43 AM
The "spaceship" operator
Star Wars sneaks up on me at the oddest times. Case in point: I'm taking a class on the Perl programming language this quarter, which is a very awesome programming language for two reasons:

1. It's extremely powerful and allows me to easily do a lot of very handy things that would require me to either dig about in documentation for the right function combination or muck about writing a subroutine to do it myself.

2. The syntax of Perl allows for things that sound a bit more like natural English and allows for a certain amount of whimsy in the code. I have to love any language that allows me to write a line like this:

open FILE ">>filename" or die "Couldn't open file!";

Basically, if the open bit fails, then the the program exits abnormally -- it dies -- and prints the message in quotes to the standard error output.

I ran into a bit more of that whimsy today in class, although it was a bit less obvious. Perl includes another very handy comparison operator called the "spaceship" operator that looks like this:

$op1 <=> $op2

It returns -1, 0 or 1 based on whether $op1 is less than, equal to or greater than $op2. I've used that operator before, and I was vaguely curious as to where it got the nickname "the spaceship operator". At first glance it didn't look like a spaceship to me, more like a biconditional operator. Well, that was answered in class today. The teacher explained that it was so named because it looked like 'that spaceship from Star Wars."

Oh, I get it now, it looks like a TIE Fighter! Now that is geekiness at it's extreme. B-) That would make a great emoticon-ish type of thing....a fighter-icon!!

More ASCII fighter-icons