I think this is a "bug", but not necessary to be a bug introduced during the implementation phase. This most likely is a bug introduced at the spec phase, or it is something never clearly defined. (At the end of this post, I have another exapmple)

One of the benefit we get from Perl is that it has very "rich" syntax, many shortcuts... However this may come back and bite us, or to be more precise bite Perl, not really us.

The richness of Perl's syntax actually sacrifices the rightness of its syntax to a certain level.

Thanks for BrowserUK, I tried this piece of code, base on his thought:
use Data::Dumper; { $a = 1; $b = 2; $c = 3; @a = \($a,$b, $c); print @a, "\n";#this is an array of ref } { $a = 1; $b = 2; $c = 3; $d = [\($a,$b, $c)]; print @$d, "\n";#this is an array of ref } { @a = \(1..3); print Dumper(@a);#this is an ref to an array }
This does not make sense to me at all. One may come up with some explanation for this, but I would not buy any explanation.

My philosophy is simple:
  1. Good syntax should be consistant all the way
  2. What I actually get matches what I see
Another example of bad syntax: the other day I tried redo within a do {} until block, but Perl complains that I could not use redo outside a loop block, which means Perl does not take do {} until as a loop block.

Thanks for gjb, he explained to me that he experienced the same problem a while back, and he figured out that is what Perl does, and it does not take do {} until as a loop block.

So it is not a bug, it is a feature, from the view of Perl's implementation phase, but this syntax is definitely flawed. It does not make any sense that, a do {} until block is not a loop block, when I am clearly using it for ITERATING.

Update

This is a very high-yielding discussion, and I must say I learned lots, thanks fellows.

However my point still stands. My point is regardless what is making the iteration, regardless what is being iterated, regardless whether the iteration is IMPLICIT or explicit, Perl actually knows there is a BLOCK it should iterate through, and in fact it is doing that iteration for us, then redo is within a loop block (or to be precise, a loop block Perl refused to recognize, although obviously it recognized and LOOP's thru), so redo should be handle as usual.

This is what I expected to happen, ;-) I still think it is what should happen.

In reply to Re: Anon. array of refs to a range generated list of scalars. by pg
in thread Anon. array of refs to a range generated list of scalars. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.