http://www.perlmonks.org?node_id=296013

BUU has asked for the wisdom of the Perl Monks concerning the following question:

As I understand it right now, every piece of code is made of "statements". Each of these statements is made up of an "expression" and possibly an "expression modifier". The expression is of course something like "$a='b'", and the modifer is something along the lines of "if bar;" or "while foo". Currently, in perl5, you can only have one of these modifiers, so that $x = 'b' while(<foo>) if $bar; doesn't work. Anyone know if there is any planning to change this in perl6?

Replies are listed 'Best First'.
Re: Perl 6: Multiple subexpression modifiers with in a statement?
by Aristotle (Chancellor) on Oct 02, 2003 at 20:25 UTC
    I hope so - it would certainly be useful to be able to write
    s/foo/bar/ for @$_ for @LoL;
    Last I checked, it wasn't decided either way.

    Makeshifts last the longest.

Re: Perl 6: Multiple subexpression modifiers with in a statement?
by Elian (Parson) on Oct 03, 2003 at 13:12 UTC
    Yes. It'll work.

      Will it simply associate modifiers right-to-left? As in, the rightmost modifier modifies everything to the left of it, etc. What I'm getting at is that I don't want to have to think about something like "modifier precedence" when chaining them like this.

      kelan


      Perl6 Grammar Student

        It'll be strict right-to-left. Just don't throw mys in there, as proper scoping in chained modifiers is never what people expect, and may well just be disallowed.