I recently pasted the following code:
my @cards = qw(BB BR RR);
my $n_trials = shift || 100;
for (1 .. $n_trials) {
my $card = $cards[ int(rand 3) ];
my @faces = split //, $card;
my $face_choice = int(rand 2);
my ($face, $other_face) = @faces[$face_choice, 1-$face_choice];
if ($face eq "R") {
# this trial is spoiled; do it over
redo;
} else {
$count{$other_face} += 1;
}
}
print "In $n_trials trials:\n";
for my $other_face (keys %count) {
print " The other face was '$other_face' in $count{$other_face} trials\n";
}
The Markdown engine displays the code incorrectly. For example, the for
in the fourth line is indented by eight spaces, the same as the my
on the third line. But it is displayed as if it were indented 12 spaces.
Similarly, the three following lines that begin with my
should all be aligned the same, but the third (my $face_choice
) is indented four spaces too far.
There are other errors; you can view the source of this note to see how it should be indented.
The code does not contain any tabs or trailing spaces.
Here is a screenshot that shows the incorrect rendering, in case it works properly on your browser.