Wednesday, 11 November, 2009

Perl poetry

 Perl is said to be close to natural language in many ways. But, can you write a poem in it that expresses your heart? Let's see:

my $sweetheart;
my $heart = $yours for $ever;
do { accept my $love, my $dear }, or kill $me;

bless \$me, my $Lord; join($us, $together) until eternity; 
heaven: our $home, wait for $us; 

my $soul, my $darling, say "I love you";
let's, $honey, splice(@together), not split $ever,  
                                   and goto heaven, $together;

Perl indeed does a good job, isn't it?
So, why am I into this crazy stuff suddenly? Well, there was this post in my friend Sharmi's blog that said:
Love is the language between two hearts; for everything else there is C#

which is apparently a praise of C#. Well, I thought, why for everything else only? :)

The real deal here is that the above is valid Perl code, and when executed, prints "I love you" repeatedly on the screen.

Now take that, C#. :)

*Execution instructions: You need Perl 5.10 or above, and probably need to enable the 'say' feature. If you saved the above program as, the invocation might be: perl -Mfeature=say
This would fill your screen with text, so be ready to press Ctrl-C immediately. :)
PS: I do like C#, and in fact think MS did a great service to humanity by relieving many developers from Java. It's just that I love Perl even more. ;)