Stevan Little writes:
> my $a = 'a';
> my $b = '';
> my $c = '';
>
> my $any_of_them = $b | $c | $a;
> # this test passes
> ok('a' eq $any_of_them, '($b | $c | $a) matches at least one "a"');
>
> $b = 'b';
> $c = 'c';
>
> # this test passes ...
> ok('a' eq $any_of_them, '($b | $c | $a) matches at least one "a"');
> # but these two tests don't
> ok('b' eq $any_of_them, '($a | $b | $c) matches at least one "b"');
> ok('c' eq $any_of_them, '($c | $a | $b) matches at least one "c"');
That behavior is correct. Just as if you said:
my $a = 'a';
my $b = $a;
$a = 'b';
say $b; # a
This should work, however:
my $a = 'a';
my $b = '';
my $c = '';
my $any_of_them = \$a | \$b | \$c;
$b = 'b';
$c = 'c';
ok('b' eq $$any_of_them); # passes
That second $ might not need to be there. I don't understand exactly
how transparent references are yet.
Luke