Best. Perl Script. Ever.

A user recently asked:

What has been your best programming experience so far?

The most successful program I’ve ever written was this Perl script:

map(($r=$_,map(($y=$r-$_/3,$l[24-$r]
.=(' ','@')[$y**2-20*$y+($_**2)/3<0]),(0..30)),),(0..24));
print join("\n", map(reverse($_).$_, @l)), "\n";

I wrote this for a woman I was dating in 2001. Writing a Perl script for my girlfriend is not as geeky as it sounds, at least in this case. She’s also a software developer, and she was taking a Perl class at the time.

I consider this script a great success because she married me in 2007!

I’ll leave it as an exercise for the reader to run the script in a console window and see its output (I promise it’s not a Trojan Horse or any other kind of evil trick).

I’m posting to my blog the questions I’ve answered on StackOverflow, which earned the “Good Answer” badge. This was based on my answer to “What is your best programming experience?


Posted

in

by

Tags:

Comments

10 responses to “Best. Perl Script. Ever.”

  1. Elise Avatar

    Just ran this script… All I can say is "aww…" and that was extremely nifty!

  2. PIYUSH Avatar

    hey it's awesome!!!

  3. Amol Parnaik Avatar

    That's brilliant!

  4. Amol Parnaik Avatar

    That's brilliant!

  5. Amol Parnaik Avatar

    That's brilliant!

  6. Anonymous Avatar
    Anonymous

    Indeed a wonderful script…!!!

    Is the motivation behind this 1:

    perl -le 'map {$y = $_ / 15; print map {("@", " ")[(-57 > $_ || $_ > -53) && ($_ ** 2 / 1250 + $y ** 2 – 1) ** 3 > $_ ** 2 * $y ** 3 / 2500 && 0.2 * ($_ – 60) ** 2 – 18 > 15 * $y || 15 * $y > ($_ – 60) ** 2 – 15]} -75..75 } reverse -18..18'

  7. Bill Hallahan Avatar

    Kudos. That IS the best perl script ever. No arguing with results!

  8. Colby Gatte Avatar

    This comment has been removed by the author.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.