Perl 6 variable same name different sigils inconsistent behavior

It seems that there is an incorrect behavior when using variables of the same name but different characters:

> my $a="foo";
foo
> my @a=1,2
[1 2]
> say $a
foo               # this is what I have expected
> my $b = 1,2,3
(1 2 3)
> my @b = (0, $b.Slip)
[0 1]             # I expect to get [0 1 2 3]; (0, |$b) not work either
> say $b
1                 # I expect $b to be unchanged, (1,2,3), but it is now 1;
> say @a
[1 2]
> say @b
[0 1]
>

I’m not sure why it @adoesn’t influence $a, whereas it @bdoes $b. Can someone clarify the issue?

Thank!!!

lisprog

+4
source share
1 answer

In Rakudo Perl 6 there is virtually no relationship between $band @b.

$b . , , , . , , = () , ,.

, REPL, . , , .

my $b = 1,2,3 , (my $b = 1),2,3, = , ,, , , ,

> (my $b = 1),2,3
(1 2 3)
> $b
1

$b, :

> my $b = (1,2,3)
(1 2 3)
> $b
(1 2 3)
+6

Source: https://habr.com/ru/post/1682786/


All Articles