Some suggested basic 'rules': (1) Must work with use strict and use warnings (2) The code itself must 'act out' the song title (3) The OUTPUT of the script must also serve as a clue to the song title.
And three examples from the very excellent Smiths to start the ball rolling. First up, 'There is a light that never goes out':
#/usr/bin/perl use strict; use warnings; print "Guess the song title:\n"; # 'There is a light that never goes out' (The Smiths) my $light = 1; while (1) { $light = 0 if 1 < 0; print "Light is ", $light ? "on" : "off", "\n"; sleep 1; }
Second example, 'Some girls are bigger than others':
#/usr/bin/perl use strict; use warnings; print "Guess the song title:\n"; # 'Some girls are bigger than others' (The Smiths) for my $girl (1..5) { print "Girl number $girl is size ", int( rand 20 ), "\n"; sleep 1; }
And finally for now, 'Stop me if you think you've heard this one before':
#/usr/bin/perl use strict; use warnings; print "Guess the song title:\n"; # 'Stop me if you think you've heard this one before' (The Smiths) my %heard_before; my @joke_topics = ('penguin', 'chicken', 'elephant', 'badger', 'ape'); JOKE: while (1) { my $topic = $joke_topics[ int( rand 5 ) ]; print "Did you hear the one about the $topic...?\n"; if ($heard_before{ $topic }++) { print "...OK you better stop me, I'm repeating myself now.\n"; last JOKE; } sleep 1; }
Any other ideas?
In reply to Song titles challenge by oxone
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |