This is a quiz. Below are 6 examples of perl "bugs" that have been
reported to perl5-porters in the last 3 weeks and determined to be not bugs. One
reporter, (I believe) the only perlmonk among them, had already figured
out the difficulty and was providing a documentation patch to clarify
things. Of the others, four are somewhat documented.
Your mission, should you choose to accept it, is to find the documentation (if any) that supports perl's actual behaviour. Or at least figure out why perl is doing what it is doing. Or at least have some fun and maybe learn something new.
Update: reordered the tests (before any replies) Update: verbosify ok() subuse strict; use warnings; use vars '$x'; sub ok ($$) { my ($testnum, $check) = @_; if ($check) { print "ok $testnum\n"; } else { print "not ok $testnum\n" } } $x=0; { no strict 'refs'; my $x=42; my $y = 'x'; ok 1, ${$y} == 42; } ok 2, eval 'no warnings; sub Foo::INIT { 42 } &Foo::INIT();'; $x="ad"; for ($x) { /a/gc; /\Gb?/gc; ok 3, /\Gc?/gc; } ok 4, eval ' "(R)" =~ m(\(?r\)?)i '; $x=1; { my $x=2; sub x {eval '$x'} } { my $x=3; ok 5, x; } ok 6, 17.98 == 17.99 - .01;
Back to
Meditations