develooper Front page | perl.perl5.porters | Postings from March 2016

Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
March 6, 2016 09:18
Subject:
Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Message ID:
20160306091843.GA25907@plasmasturm.org
* Kent Fredric <kentfredric@gmail.com> [2016-03-06 06:20]:
> On 6 March 2016 at 10:59, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> > […]
>
> What would this do?:
>
> $prefix = "/some/path/with a space/";
> @y = qqw{   $prefix/hunter  $prefix/bar  };
>
> Your description so far indicates that the output would be
>
> ( '/some/path/with' , 'a' , 'space/hunter'  )

Sorry for the confusion. If you ignore the opening prose and concentrate
on the examples, they will show you what I intended, but since I screwed
that up, let me restate my position for clarity.

This line:

    qqw( $prefix/foo $prefix/bar $prefix/baz );

… ought to yield the same result as this line:

    ( "$prefix/foo", "$prefix/bar", "$prefix/baz" );

… and *not* as this line:

    split ' ', "$prefix/foo $prefix/bar $prefix/baz";

… because that last line is already real easy to write in various ways
that allow low-ceremony syntax for larger lists. E.g. for larger lists,

    split ' ', qq(
        $prefix/foo
        $prefix/bar
        $prefix/baz
        $prefix/quux
        $prefix/qux
        ...
    );

There’s little point in adding yet another way of writing that, when the
other kind of result incurs a per-item punctuation tax:

    (
        "$prefix/foo",
        "$prefix/bar",
        "$prefix/baz",
        "$prefix/quux",
        "$prefix/qux",
        # ...
    );

(And that’s the least noisy way of formatting it.)

So that is the case that ought to gain some syntactic relief, if any.

Hope I did a better job this time.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About