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 perlpoetry.pl, the invocation might be: perl -Mfeature=say perlpoetry.pl
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. ;)

8 comments:

SSN said...

Lovely post. And, I'm copying this poem :)
Well, this seems to be a good technique to propose someone... Send a poetic script and ask him/her to run it :)

P.S. But as I've quoted in my post, for everything else, C# rocks! ;)

Ryan.A.Nash said...

Good 'un. :)

How exactly did you find this?

Koushik said...

Nice :-)
But if you see, you need to have "dollar" in every step, till you go to heaven.
Else everything is invalid.
PERL says philosophy too ;-).

Sundar said...

@SSN:
Well, it's a good technique only if that 'someone' is also a certified geek.
Who am I kidding though - who would ever want to propose a non-geek? ;)

Sundar said...

@Ryan:
As I lay awake deep into the night at work, variables and keywords aligned themselves in front of me, and asked of me: "Why are we always damned to be in soulless scripts operating on material data? Oh, how we wish to act on hearts, and be a messenger of emotions!". Their plea touched my heart, and henceforth arose this piece of art.
In short, I was bored of work and abused my company's Internet connection writing it. :)

Sundar said...

@Koushik:
Great find... The program works only because dollar goes before 'me' everywhere. :)

Ryan.A.Nash said...

Ha ha, awesome. Love the philosophy ;)

Sam said...

Awesome buddy,,,, got inspired :)keep up the great work..