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:
Eirik Berg Hanssen
Date:
March 5, 2016 21:29
Subject:
Re: [perl #127640] RFE: "qqw( $var/x $var/y word3 $var4=word4 )"
Message ID:
CAHAeAG7M_rOdjLRBGS1FQwj4DdYMxx8q4JHPV4B3uVU1W1OXRg@mail.gmail.com
On Sat, Mar 5, 2016 at 8:06 PM, Father Chrysostomos via RT <
perlbug-followup@perl.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 >;


  In Perl6, this does the former, too:

eirik@purplehat[22:25:34]~$ perl6 -e 'my $x = "good job"; my @y = « $x
hunting »; .say for @y'
good
job
hunting
eirik@purplehat[22:25:42]~$

  … which surprised me, until I found that this does the latter:

eirik@purplehat[22:27:52]~$ perl6 -e 'my $x = "good job"; my @y = « "$x"
hunting »; .say for @y'
good job
hunting
eirik@purplehat[22:27:56]~$

 :)


Eirik

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