> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Mon, 4 Nov 2002 12:09:12 -0800 (PST)
> From: Austin Hastings <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
> 
> Something from [EMAIL PROTECTED] about the relative frequency made me
> wonder:
> 
> What's the "order of evaluation" or "nestedness" for separate streams
> in a for loop?
> 
> That is, can I meaningfully say:
> 
> for my $i; $j -> 0 .. @array.length - 1; $i + 1 .. @array.length
> {
>  ..
> }

I don't know where to correct you first... <:)

I'll start by saying your variables are on the wrong side of the
pointy sub.  Also, presuming you switched the order, that C<my>
shouldn't be there and would be an error.  Also, you don't need those
C<.length>s, but I guess they don't hurt.

Finally, multi-stream C<for> iterates I<in parallel>.  So:

  for 0..@array-1; $i+1..@array -> $i; $j {
      ...
  }

Would.. um..  I think that's an error.  Or, it is if C<use strict> is
on.   Otherwise it would use the undefined C<$i> (unless, of course,
it was defined in an enclosing lexical scope).

Luke

Reply via email to