Not all core functions can be overridden. print is one of those that cannot.
Even the following doesn't work
package MyPrint; sub print { shift; CORE::print("[\n"); CORE::print(@_); CORE::print("]\n"); } package main; bless *STDOUT{IO}, 'MyPrint'; print("Hello World!\n"); # builtin print STDOUT ("Hello World!\n"); # builtin
but this does
STDOUT->print("Hello World!\n"); # custom
I think tieing also works.
In reply to Re: Overriding built-ins
by ikegami
in thread Overriding built-ins
by chas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |