Exactly, because the method and the builtin are in different namespaces aka packages.
The method call -> will look into the "STASH" of MyPackage:: while calls to builtins are resolved in CORE:: (resp. CORE::GLOBAL ) °
You can actually override (some) builtin functions, but that's not what is happening here.
°) see https://perldoc.perl.org/perlsub#Overriding-Built-in-Functions for details on real overriding
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: Override built-in functions?
by LanX
in thread Override built-in functions?
by TorontoJim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |