develooper Front page | perl.perl6.users | Postings from September 2017

Re: Need append help

Thread Previous | Thread Next
From:
ToddAndMargo
Date:
September 29, 2017 19:27
Subject:
Re: Need append help
Message ID:
e046c754-83d3-9635-4254-8e82bcf08289@zoho.com
On 09/29/2017 12:12 PM, Andy Bach wrote:
> Hmm
> $ perl6 -e 'my $x="abc"; $x [R~]= "yyz"; say $x;'
> yyzabc
> 
> no space:
> $ perl6 -e 'my $x="abc"; $x[R~]= "yyz"; say $x;'
> ===SORRY!=== Error while compiling -e
> Missing required term after infix
> at -e:1
> ------> my $x="abc"; $x[R~⏏]= "yyz"; say $x;
>      expecting any of:
>          prefix
>          term
> 
> $ perl6 -v
> This is Rakudo version 2016.10-285-gee8ae92 built on MoarVM version 
> 2016.10-55-g20c8591
> implementing Perl 6.c.
> 
> $ rakudo-star-2017.07/install/bin/perl6 -v
> This is Rakudo version 2017.07 built on MoarVM version 2017.07
> implementing Perl 6.c.
> 
> $ rakudo-star-2017.07/install/bin/perl6 -e 'my $x="abc"; $x [R~]= "yyz"; 
> say $x;'
> Potential difficulties:
>      Useless use of [R~]= in sink context
>      at -e:1
>      ------> my $x="abc"; $x ⏏[R~]= "yyz"; say $x;
> yyzabc
> 
> no space
> $ rakudo-star-2017.07/install/bin/perl6 -e 'my $x="abc"; $x[R~]= "yyz"; 
> say $x;'
> ===SORRY!=== Error while compiling -e
> Missing required term after infix
> at -e:1
> ------> my $x="abc"; $x[R~⏏]= "yyz"; say $x;
>      expecting any of:
>          prefix
>          term
> 
> 
> On Fri, Sep 29, 2017 at 1:59 PM, ToddAndMargo <ToddAndMargo@zoho.com 
> <mailto:ToddAndMargo@zoho.com>> wrote:
> 
>     On 09/29/2017 11:32 AM, Sean McAfee wrote:
> 
>         On Fri, Sep 29, 2017 at 11:27 AM, Brandon Allbery
>         <allbery.b@gmail.com <mailto:allbery.b@gmail.com>
>         <mailto:allbery.b@gmail.com <mailto:allbery.b@gmail.com>>> wrote:
> 
>              On Fri, Sep 29, 2017 at 2:04 PM, ToddAndMargo
>         <ToddAndMargo@zoho.com <mailto:ToddAndMargo@zoho.com>
>              <mailto:ToddAndMargo@zoho.com
>         <mailto:ToddAndMargo@zoho.com>>> wrote:
> 
> 
>                  Question:  Is thee a pretty way like the above to do a
>         prepend?
> 
> 
>              No, sorry.
> 
> 
>         Actually, there seems to be:
> 
>           > my $x = "abc"
>         abc
>           > $x [R~]= "xyz"
>         xyzabc
>           > $x
>         xyzabc
> 
> 
>     :'(
> 
>     What am I doing wrong?
> 
> 
>     $ perl6 -e 'my $x="abc"; $x [R~]= "yyz"; say $x;'
>     ===SORRY!=== Error while compiling -e
>     Missing required term after infix
>     at -e:1
>     ------> my $x="abc"; $x[R~⏏]= "yyz"; say $x;
>          expecting any of:
>              prefix
>              term
> 

I do not understand.  :'(


$ perl6 -v
This is Rakudo version 2017.07 built on MoarVM version 2017.07
implementing Perl 6.c.


$ perl6 -e 'my $x="abc"; $x[R~]= "yyz"; say $x;'
===SORRY!=== Error while compiling -e
Missing required term after infix
at -e:1
------> my $x="abc"; $x[R~⏏]= "yyz"; say $x;
     expecting any of:
         prefix
         term


$ perl6 -e 'my $x="abc"; $x [R~]= "yyz"; say $x;'
Potential difficulties:
     Useless use of [R~]= in sink context
     at -e:1
     ------> my $x="abc"; $x ⏏[R~]= "yyz"; say $x;
yyzabc


$ perl6 -e 'my $x="abc"; $x[R~] = "yyz"; say $x;'
===SORRY!=== Error while compiling -e
Missing required term after infix
at -e:1
------> my $x="abc"; $x[R~⏏] = "yyz"; say $x;
     expecting any of:
         prefix
         term

$ perl6 -e 'my $x="abc"; $x [R~] = "yyz"; say $x;'
===SORRY!=== Error while compiling -e
Preceding context expects a term, but found infix = instead
at -e:1
------> my $x="abc"; $x [R~] =⏏ "yyz"; say $x;

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