Subject: | random generator bug in Abbott & Costello tutorial |
In Abbott and Costello, an example from the tutorial "The man(1) of descent" (Parse-RecDescent-1.94/tutorial/tutorial.html) and also in Parse-RecDescent-1.94/demo/demo_whoson.pl.
The choose method never return the first element "$_[0]" of the array.
use Parse::RecDescent;
-sub Parse::RecDescent::choose { $_[1 + int rand $#_]; }
+sub Parse::RecDescent::choose { $_[int rand @_]; }
$abbott = new Parse::RecDescent <<'EOABBOTT';
There others bugs in the Abbot & Costello version of the tutorial but they are corrected in demo/demo_whoson.pl.