In creating some new Perl 6 programs I've run across several instances
I'm confused about, to wit:
> my %h; say 'false' if !%h<a>:exists;
Unexpected named parameter 'exists' passed
> my %h; say 'false' if not %h<a>:exists;
It looks like '!' doesn't work as I thought it was supposed to. But,
I just discovered that when I use parens, it works.
> my %h; say 'false' if !(%h<a>:exists);
I presume the parens would cure the similar things I've noticed with
When I look at the docs on Operators I see this:
multi sub prefix:<!>(Mu) returns Bool:D
Negated boolean context operator.
Coerces the argument to Bool by calling the Bool method on it, and
returns the negation of the result. Note that this collapses
multi sub prefix:<not>(Mu $x) returns Bool:D
Evaluates its argument in boolean context (and thus collapses
Junctions), and negates the result.
Those two definitions look very similar to my eyes, but I think the
subtle difference is intentional.But they are not identical.
Is there some rule of thumb here that a Perl 6 wannabe can grasp in
Perl 5 terms (e.g., prefer 'not' over '!')? Or am I going to have to
go deep early into the object class structure?