On Sat, Jul 23, 2005 at 10:25:20AM -0400, Anthony DeRobertis wrote:
>perlsyn says you can't have
>       for (EXPR; EXPR; EXPR) BLOCK continue BLOCK
>(or at least doesn't list it as allowed). Unfortunately, perl seems to
>agree:
>
>$ perl -e 'for ($i = 0; $i < 10; ++$i) { } continue { }'
>syntax error at -e line 1, near "} continue"
>Execution of -e aborted due to compilation errors.
>
>It'd be nice if that were possible...

Well internally perl implements

  for (EXPR1; EXPR2; EXPR3) BLOCK

as

  EXPR1; while (EXPR2) BLOCK continue { EXPR3 }

which makes adding a continue block a bit trickier.  It does however
suggest your solution, stash your contine expressions after ++$i:

  for ($i = 0; $i < 10; ++$i, CONT) { }

--bod



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to