in reply to Re: How do you define "elegant"?
in thread How do you define "elegant"?

tinita,
My response has nothing to do with elegance and you are quite right in your post. I do want to point out that the two snippets are not functionally equivalent.

In the first inelegant snippet, the index var continues to exist beyond the for loop. In the second elegant snippet, it does not. This is because in Perl 5, an implicit block is defined. Last I heard, this will not be the case in Perl 6 and these two snippets would be functionally equivalent. I would have written it this way in Perl 6:

for 0 .. $exprs.end -> $index { # ... }

Cheers - L~R