in reply to Re^2: Unexpected behaviour with constant lists and foreach (and closures?)
in thread Unexpected behavior of '..' lists

Indeed. It's probably implemented identically to for (my $x=expr1 ; $x<=expr2 ; $x++) { blah }

Update: Changed "<" to "<=".

Replies are listed 'Best First'.
Re^4: Unexpected behaviour with constant lists
by diotalevi (Canon) on Jul 20, 2006 at 19:32 UTC

    It's not implemented like that at all. There's a specific set of ops meant for the range operator. It's much better than the longhand for(;;) which would be lots of more ops to dispatch.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      There's a specific set of ops meant for the range operator.
      In general, yes, but those aren't used at all in this optimization. The only compilation difference between for (1..4) { } and for (1,4) { } is the former sets OPf_STACKED on the enteriter op. </c>
      t's much better than the longhand for(;;) which would be lots of more ops to dispatch.
      Yes.