Hi,
This is the same behaviour you can find in perl5 and is not a flaw. It is
an assignment just before testing. So $x gets the value of $y and then test
which becomes True.
This can also be very covenient when e.g calling a sub, then assign to a
value then test like below in a while;
while my $nchars = $mystring.chars { # do something with $nchars }
Marcel
On March 18, 2017 10:20:36 AM ToddAndMargo <toddandma...@zoho.com> wrote:
Dear Perl 6 Developers,
Request for Enhancement:
Would you consider throwing a compiler error on the following:
perl6 -e 'my $x=2;my $y=3; if $x = $y {say "yes";} else {say "no";}'
yes
It should have two == signs if it is followed by a {do something}
This is the correct way:
$ perl6 -e 'my $x=2;my $y=3; if $x == $y {say "yes";} else {say "no";}'
Many thanks,
-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Serious error.
All shortcuts have disappeared.
Screen. Mind. Both are blank.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~