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

Re: Need append help

Thread Previous | Thread Next
From:
Timo Paulssen
Date:
September 29, 2017 19:30
Subject:
Re: Need append help
Message ID:
b96d1076-b59c-3a30-c631-893a9db23da7@wakelift.de
On 09/29/2017 09:27 PM, ToddAndMargo wrote:
> $ 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

This is the correct one. The warning about "useless use" here is a bug
in rakudo. It's meant to warn for things like

    perl6 -e '1 + 2';

where you calculate something and do nothing with it. Here it just
forgets to take into account that this is an assignment operation.

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