Have a perl brain-teaser:
my @l = ('a', 'b', 'c');
for (@l) {
my $n = 1;
print shift @l while (@l and $n --> 0);
print "\n";
}
What is he typing? Must be a, b and c, right? But oh wait, there is an error somewhere, it only prints the letters a and b. Probably just some kind of stupidity one by one, it should be easy to solve, right?
So do a little code change to check everything and change @l to
my @l = ('a', 'b', 'c', 'd');
What is he typing? Probably a, b and c are stupid from one because of this, right? ... Wait a second, in fact it still only prints a and b. Okay, so the mistake is that it only prints the first two characters.
Change @l to again
my @l = ('a', 'b', 'c', 'd', 'e');
Uhm, a, b c. d e. , 2 , , . , f, a, b c, f g, a, b, c d.
$n.
, ?