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

Re: Need append help

Thread Previous | Thread Next
From:
Brandon Allbery
Date:
September 29, 2017 19:08
Subject:
Re: Need append help
Message ID:
CAKFCL4X14c_ZbVjSMUAqkQbFJHZCgCTT4zmjLjASbMcykW+2yw@mail.gmail.com
On Fri, Sep 29, 2017 at 2:59 PM, ToddAndMargo <ToddAndMargo@zoho.com> wrote:

> $ 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
>

Missing space, so it thinks the [ is trying to index $x and then gets
confused when it sees the metaop instead of an index.

I also get a spurious warning locally with the corrected version.

pyanfar Z$ 6 '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
zsh: exit 1
pyanfar Z$ 6 '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

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

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