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 5, 2016 21:59
Subject:
Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Message ID:
20160305215937.GA78191@plasmasturm.org
* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-03-05 20:10]:
> On Sat Mar 05 10:14:48 2016, perl.p5p@rjbs.manxome.org wrote:
> > $x = "good job";
> > @y = qqw( $x hunter );
> >
> > Is @y now ('good', 'job', 'hunter') or ('good job', 'hunter')?
> > I would think the latter.
>
> I would have assumed the former. So I suppose it’s not obvious. BTW,
> this does the former:
>
>   $x = "good job";
>   @y = < $x hunter >;

I prefer the former. So much so, in fact, that I don’t see any point in
the feature if it does the latter. Because that result is already easy
to achieve in several ways – starting with this very conventional, very
boring, nobody-will-ever-scratch-their-head-about-it approach:

    @y = split ' ', "$x hunter";

But a list in which variable values are interpolated yet atomic requires
lots of syntactic ceremony using currently available means:

    @subdir = ( "$prefix/foo", "$prefix/bar", "$prefix/baz" );

Consider how much nicer that would be if you got to leave out all those
quotes and separators:

    @subdir = qqw( $prefix/foo $prefix/bar $prefix/baz );

A qqw() that splits after interpolating would deprive us of that.

So I think it must work that way or else there’s no point in bothering.

While we’re at it – I would also prefer qqw() to allow comments, and/but
allow backslashing whitespace and octothorpes to demote them from syntax
to string content. Oh, and please – no qw()-style warnings about commas.

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