#/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; } #### #/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; } #### #/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; }