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

Re: Need append help

Thread Previous | Thread Next
Timo Paulssen
September 29, 2017 19:30
Re: Need append help
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About