in reply to Bug or inconsitency? FQN of Package and sub name identical
When barewords are involved like in
print(foo + 2);
Perl must guess at what it means. Perl usually guesses the above means
print(foo(+2));
but if foo's prototype is ($), it'll take that as a hint that you meant
print(foo() + 2);
It's the same for
Foo->method();
Perl usually guesses the above means
"Foo"->method();
but if Foo is a function, it'll take that as a hint that you meant
Foo()->method();
where Foo is presumably a function that returns a class name or an object.
|
---|
In Section
Seekers of Perl Wisdom