It seems that the loop statement currently doesn't let you declare variables inside it, so the following code:

loop (my $i = 0; $i < 10; $i++) { }

doesn't work.  Here's a test for the problem.

-garrett
Index: t/base/loop.t
===================================================================
--- t/base/loop.t       (revision 567)
+++ t/base/loop.t       (working copy)
@@ -9,7 +9,7 @@
 
 =cut
 
-plan 6;
+plan 8;
 
 # basic loop
 
@@ -34,4 +34,10 @@
 my $i = 0;
 is($i, 0, 'verify our starting condition');
 loop (;;) { $i++; last(); }
-is($i, 1, 'verify our ending condition');
\ No newline at end of file
+is($i, 1, 'verify our ending condition');
+
+# declare variable inside loop
+my $count = 0;
+is($count, 0, 'verify our starting condition');
+eval 'loop (my $j = 0; $j < 10; $j++) { $count++; }';
+todo_is($count, 10, 'verify our ending condition');

Reply via email to