19 January, 2009

Aside: Perl

I am trying to learn how to code in Perl. I am doing this because I find computational biology and mathematical modeling of biology to be intensely interesting. However, writing meaningful programs is currently a bit beyond my abilities. So, I submitted a variant of this as a joke to Thinkgeek. I thought I might post this for all of your enjoyments/amusements.
#!/usr/bin/perl

print "Who is awesomer (you/me)? ";
chomp($base = );

if ($base eq you) {print "Correct, you can has cookie.\n"};
if ($base eq me) {print "Fail.\n"};
If you should wish to actually run this program (for whatever bizarre reason), then:
1) Copy-paste into Notepad or a simple text editor (not MS Word).
2) Save somewhere you'll remember it at.
3) Access the folder you stashed it in from your command line using the \cd function.
4) Type "perl filename" (filename = whatever you named it) and it will run (this'll work natively in a Unix system [Mac]{I think}, might be more difficult in a Windows environment, where you'll need a Perl module installed).
5) If you want to alter it to help boost your self-confidence or momentary feelings of awesomeness, then you can alter the pieces following in bold.
#!/usr/bin/perl

print "Who is awesomer (you/me)? ";
chomp($base = );

if ($base eq you) {print "Correct, you can has cookie.\n"};
if ($base eq me) {print "Fail.\n"};
For it to work, red has to match red and blue has to match blue, letter for letter. And the space after the question mark is important, so don't delete it.

I think this qualifies me as a script kiddie. Which I don't think is too bad, considering that I'm trained as a molecular biologist and all.

No comments: