bennymack has asked for the wisdom of the Perl Monks concerning the following question:

Please forgive me if this is covered in another node somewhere but I'm going to be a heretic and ask: what are some good ways to quickly make a big impression on people (most likely kids) with perl?

For instance, if I were to sit down at my brothers computer and download strawberry perl, what could I easily do to make my nieces and nephew say "Ooh, cool!"?

Something short to type that hopefully didn't rely on too many CPAN modules would be preferable. I mainly just need ideas. I'm a programmer but it's so hard to explain what exactly that means to non-technical people and I'd like some way to show them what I'm capable of instructing computers to do, you know?

Replies are listed 'Best First'.
Re: Quick Programs to make Big Impression
by zentara (Archbishop) on Sep 02, 2008 at 18:00 UTC
Re: Quick Programs to make Big Impression
by Perlbotics (Chancellor) on Sep 02, 2008 at 22:44 UTC

    Depends on the age of the kids. You'll most probably cannot compete with their game console, so forget the 3D graphics ;-) As already suggested playing and doing experiments - something they can participate should awake their interest. Maybe you can type a tiny program, show them how it works, and let them play with it? Then add some more functionality, maybe as a kind of game?

    Some ideas, mainly for younger kids:

    • let the computer guess a number between 1 and "impressively high" - lower/higher, etc...
    • let the kids enter their initials, the computer prints a greeting with the full name...(how can it know that?)
    • do you remember the Apple ][ demo program Animals?
    • the CPAN Games directory...
    • simple encryption/decryption routine (1=A, 2=B, ... type)...
    • randomly generated sentences; let kids chose the words...
    • a simple calculator using eval...
    • Fibonacci? Faculty!
    • a mathematical game of the kind add 3 to the year you were born, subtract ... bla bla ... minus size of your shoes ... finally print their age...
    • Turtlegraphics...
    • remote controlling something... (if you have two PCs)..
    • ...
    Don't know if that really is what you expected, but a pre-nerd in the right age will become a dedicated follower ;-)

Re: Quick Programs to make Big Impression
by mr_mischief (Monsignor) on Sep 02, 2008 at 17:18 UTC
    The things that blew me away before I was a programmer myself were graphics, games, encryption, and communications tools like IRC, IM, email, browsers, web servers, telnet, ssh, BBSes, and anything that helps people get information around.

    I was drawn to programming as a way to facilitate communication rather than by simulations or game programming, so maybe that's a little skewed. I think the secret is, though, to show how easily you can do something relevant to their interests.

Re: Quick Programs to make Big Impression
by jethro (Monsignor) on Sep 02, 2008 at 17:42 UTC

    You will have a hard time convincing kids that anything printed on that ugly windows command shell is impressive.

    Nonetheless, maybe you could impress them with the help of something out of the Acme:: CPAN tree. For example Acme::LeetSpeak or Acme::Lingua::Pirate::Perl, i.e. translating sentences they write to pirate, leet, lolcat or any other nonsense language. Sadly the pirate module is no translator, but maybe you can access or simply copy the internal translator subroutine of the module

Re: Quick Programs to make Big Impression
by planetscape (Chancellor) on Sep 02, 2008 at 22:31 UTC

    Don't know if this is exactly what you have in mind (since technically it's an obfuscation), but I know when I first saw it, I went: "Holy crap, you can do that in Perl?!"



      I have a ten year old son, and he still loves running that Saturn program. We watched the movie Contact together (the opening scene from that movie is where I got the idea of zooming in, then away from Saturn) and he enjoyed that movie and could relate the obfu to it.

      In addition to that, I'll often help him write a little program to illustrate or solve a problem from his Maths homework. Easily solving a tricky problem with a very simple brute force search program that he was struggling to solve manually has helped him appreciate the awesome power of computer programming.

Re: Quick Programs to make Big Impression
by GrandFather (Sage) on Sep 02, 2008 at 21:23 UTC

    Probably something that scrapes a web page that they will recognize and does something interesting with the result. The various Perl modules for manipulating web pages make that sort of task very easy to do in a small number of lines of code.

    Perl reduces RSI - it saves typing
Re: Quick Programs to make Big Impression
by missingthepoint (Friar) on Sep 03, 2008 at 08:37 UTC

    The Eliza program may impress young'uns or the less technically inclined. Just from a quick look, I can spot Chatbot::Eliza.

    perl -MChatbot::Eliza -e 'Chatbot::Eliza->new()->command_interface()'

    email: perl -e 'print reverse map { chr( ord($_)-1 ) } split //, "\x0bufo/hojsfufqAofc";'
Re: Quick Programs to make Big Impression
by Jenda (Abbot) on Sep 03, 2008 at 16:02 UTC

    I second GrandFather's suggestion. Some web scraping could generate some interest. For example something as simple as a script that downloads all the images in a gallery. "Hey, thet are all on the same server, in the same path and their names end with integers from 001 to 147." Clickety click. "See, you give this twenty line script the URL of the first image and it downloads them all." And another one that downloads the gallery list, extracts the image URLs, downloads them, "clicks" the Next page link, etc. Fairly simple, needs few modules.

Re: Quick Programs to make Big Impression
by Anonymous Monk on Sep 03, 2008 at 04:33 UTC